Questions tagged [textscan]

Matlab function for reading formatted data.

textscan is a Matlab function for reading formatted data from text file or string.

For more details, see the Matlab's official doc.

222 questions
1
vote
1 answer

How to import data from file into variable arrays? (Matlab)

I've used matlab to create .txt files that have varying 3 columns separated by tabs (string, float, float) and varying number of rows. I am trying to read each of those 3 columns of data into 3 different variables. Here is my code: fileId =…
aboublemc
  • 71
  • 8
1
vote
2 answers

How do I read in a series of numbers using "Textscan" in MATLAB if the file is mostly text?

I have a text file that have a string of 3 numbers that I need to read into MATLAB. For Example: ####################### # # # Text Text Text # # ####################### Blah blah blah = #### Blah blah blah = #### Blah blah blah = #### Blah blah…
dewalla
  • 1,317
  • 8
  • 18
  • 42
1
vote
1 answer

How do I read comma separated values from a .txt file in MATLAB using textscan()?

I have a .txt file with rows consisting of three elements, a word and two numbers, separated by commas. For example: a,142,5 aa,3,0 abb,5,0 ability,3,0 about,2,0 I want to read the file and put the words in one variable, the first numbers in…
user3716193
  • 476
  • 5
  • 21
1
vote
1 answer

Import csv file with values within quotation marks

I want to import a csv file (data.csv) which is structured as follows Area,MTU,Biomass MW,Lignite MW CTA|DE(50Hertz),"01.01.2015 00:00 - 01.01.2015 00:15 (CET)","1227","6485" CTA|DE(50Hertz),"01.01.2015 00:15 - 01.01.2015 00:30…
max.mustermann
  • 127
  • 1
  • 1
  • 9
1
vote
1 answer

Reading whitespace and linespace delimited complex numbers from a text file in MATLAB

I have four streams of complex numbers in four columns of a text file I have to read them into a MATLAB matrix in the same format. I tried the following, but it does not work fid = fopen('~//.txt','r'); out = textscan(fid,…
Naveen
  • 458
  • 1
  • 10
  • 29
1
vote
1 answer

MATLAB: Incorrect digits when reading float from a string with sscanf

I'm trying to import float data from a text file. In order to do so, I load the individual lines from the file to a string and than parse it with sscanf (textscan shows similar behavior). For some reason, sscanf adds some deviations in the last few…
1
vote
1 answer

Reading in txt File -Matlab Line Extraction with Logic

Currently stumped with reading in a .txt file with the general layout described below: (The .txt file follows this general layout "N" times) ----------------------------------- Header Info 1 Desired data 1 More data More…
1
vote
1 answer

MATLAB CSV File Read

I have a CSV file with the following content: Header line1 Space Space Space ,1,2,3, 1,81,82,83 And I am trying to read the data portion into a numeric matrix. Here is the code I have implemented, however I am having issues. %To get the number of…
CircAnalyzer
  • 610
  • 1
  • 9
  • 29
1
vote
1 answer

Accommodating blank entries in .txt files using textscan - MATLAB

I have a 9-column tab-delimited .txt file containing numerous data-formats - some entries are however empty within 'type'. id id_2 s1 s2 st1 st2 type desig num 1 1 51371 51434 52858 52939 …
AnnaSchumann
  • 1,261
  • 10
  • 22
1
vote
3 answers

MATLAB: Cannot parse multiple floating-point values

I have a GUI with a UITable (built in GUIDE). I read in two numerical values and through a series of steps convert the floating-point value to a string. I want the user to have the ability to click on a specific cell in the UITable containing the…
DeeWBee
  • 695
  • 4
  • 13
  • 38
1
vote
1 answer

Read formated data from .txt to MATLAB correctly

Consider having a .txt file (it's name is saved as variable fName) with data (2 header rows, 5 rows and 2050 columns with data: 1-st column is Time in format hours:minutes:seconds.miliseconds, 2-nd column is a timestamp, all the rest columns are a…
GegznaV
  • 4,938
  • 4
  • 23
  • 43
1
vote
2 answers

read complicated format .txt file into Matlab

I have a txt file that I want to read into Matlab. Data format is like below: term2 2015-07-31-15_58_25_612 [0.9934343, 0.3423043, 0.2343433, 0.2342323] term0 2015-07-31-15_58_25_620 [12] term3 2015-07-31-15_58_25_625 [2.3333, 3.4444,…
Hongwei
  • 17
  • 5
1
vote
1 answer

MATLAB vs. GNU Octave Textscan disparity

I wish to read some data from a .dat file without saving the file first. In order to do so, my code looks as follows: urlsearch= 'http://minorplanetcenter.net/db_search/show_object?utf8=&object_id=2005+PM'; url=…
CeeGee
  • 13
  • 2
1
vote
1 answer

usage of textscan in Octave 3.8.2

The following is working fine when reading a data file of "1.2D+02 3.23D+01 ...." in matlab; tempvs = textscan ( input_unit, '%f', N ); tempvs = cell2mat(tempvs); tempvs = double(tempvs); But, the same would not work (does not recognize "D"…
1
vote
0 answers

Why dosn't Octave textscan skip headerlines?

I am using Octave 4.0.0 on Windows and have problems when using textscan on text data downloaded from the internet. These data have the following format on the internet: quote_date;paper;exch;open;high;low;close;volume;value 20150605;OTS;Oslo…
myotis
  • 393
  • 4
  • 16