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

Matlab, textscan: sequence of punctuation marks

I want to split a string using "," as delimiter but I'm not able. I tried: temp = textscan('the first","the second','%s',2,'Delimiter','","'); but the result is: temp{:} ans = 'the first'
FrancescoVe
  • 1,060
  • 1
  • 7
  • 12
1
vote
1 answer

Using textscan in Matlab to handle data not properly formatted data

I'm using textscan to import data. I can get to it successfully import properly formatted data. I can't get it to properly handle data that isn't properly formatted. Below is the format of the data. JeB2021Da 12-13 and stuff, 1, 1, 0, 1, 0, 1, 1,…
user2743
  • 1,423
  • 3
  • 22
  • 34
1
vote
1 answer

Using textscan in Matlab to import data with multiple delimiters

I'm trying to import data from a text file using textscan. The data has a couple delimiters(colon and space). I'd like to import the data into a matrix that will have 137 columns. Below is two lines of the data and the format it is in. 2 id:1 1:3…
user2743
  • 1,423
  • 3
  • 22
  • 34
1
vote
1 answer

Matlab: using textscan to read complex numbers

I have a text file cTest.dat with a bunch of complex numbers in the following format: (2.324,2432) (-1.24,-3.43) (2.4,0) (1.24,-8.85) (-2.324,4.56) (-1.24,-3.43) and I'd like to read them into matlab. From the help site it seems textscan would…
jorgen
  • 3,425
  • 4
  • 31
  • 53
1
vote
1 answer

textscan and the white spaces

A web page contains some data displayed by some columns and delimited by the tag "pre" "/pre" : ColumnA ColumnB ColumnC ColumnD ColumnE 01/2050 1009.0 11 9 01/1950 1009.0 8 01/1850 1009.0 11 …
Mixo
  • 191
  • 13
1
vote
1 answer

MATLAB's Textscan Format Complexity vs post-processing

I have a question about MATLAB's textscan. I have a file with a very large number of columns, and anywhere from 1-32 rows (very small when compared to #col). Here is a simple example: Test1 1 2 3 4 5 Test2 6 7 8 9 10 The number of columns aren't…
Diego
  • 16,830
  • 8
  • 34
  • 46
1
vote
2 answers

Reading CSV file using matlab- separating strings

I am trying to read a CSV file using Matlab and plot it. Basically, I would like to plot time vs. heart rate. However, when I use textscan it copies both columns into one and I'm not sure how to separate it. I would like to save time in a variable x…
user3267461
  • 23
  • 1
  • 2
  • 4
1
vote
3 answers

Reading external files more efficiently in MATLAB

I have the following problem, i have develop a code to search into large files containing data, the process become too slow and even in some computers it consumes all the available computer resources. nodo=str2num(get(handles.nodo,'string')); …
user2751649
  • 89
  • 1
  • 1
  • 8
1
vote
1 answer

Matlab want to skip rows with 1 less column using textscan

I'm reviving an old script in Matlab which uses "[d h v c t] = textread(fn,'%s %*s %s %f %s %s');" to import data, I want to replace the textread with textscan as that seems to be recommended. My problem (with both the old and the new) is that my…
Sarah
  • 3,022
  • 1
  • 19
  • 40
1
vote
1 answer

MATLAB error message when plotting big data files?

I have written code to plot data from very large .txt files (20Gb to 60Gb). The .txt files contain two columns of data, that represent the outputs of two sensors from an experiment that I did. The reason the data files are so large is that the data…
James Archer
  • 421
  • 2
  • 6
  • 16
1
vote
1 answer

Error "std::exception" with function textscan in Matlab 2013b

i have a file Text.txt with following sepecified content: !typ truck,bus,car,motor,bicycle !end typ !allowed car,motor,bicycle !end allowed I want to get the string "car,motor,bicycle" from the row "!allowed car,motor,bicycle". So I did these…
1
vote
2 answers

store string and integer type CSV file into a matrix matlab

I have a CSV file that has 3 columns having : String type(This can be a word or a sentence), integer type, integer type [these are the column types] Now I want to store this data into a matrix,where the string(the whole sentence is stored…
LoveMeow
  • 3,858
  • 9
  • 44
  • 66
1
vote
1 answer

Robust reading of a tabulated data file with Matlab

I'm trying to access the numerical data in a text file that is produced by a measurement device. The files are a mix of strings and numbers, and items are separated by tabs. It is not rectangular, which makes them not suitable for matlab's file…
Cape Code
  • 3,584
  • 3
  • 24
  • 45
1
vote
2 answers

Text Scanning to read in unknown number of variables and unknown number of runs

I am trying to read in a csv file which will have the format Var1 Val1A Val1B ... Val1Q Var2 Val2A Val2B ... Val2Q ... And I will not know ahead of time how many variables (rows) or how many runs (columns) will be in the file. I have been…
user1543042
  • 3,422
  • 1
  • 17
  • 31
1
vote
3 answers

Matlab: Textscan with blank spaces

I have a textfile formatted like this: 3,4, ,CMX COP,JUL11,ABCD4,APPM,CME,4PTS09,F,HG,27, , ,1,4.3,2,27,23,1,NCAP1,0 5,6, ,AUD,JUN11,ABCD4,APPM,CME,4PTS09,F,6A,11, , ,1,1.7,10,27,23,1,NCAP1,0 I'm trying to read it with textscan, but I don't know…
siegel
  • 819
  • 2
  • 12
  • 24