Scan multi rows using textscan in matlab -


i have variable contains 2 rows string same number of columns follows :

 0 -> 2 1.000000 1.000200 a-mpdu 1.000000 1.000100 success 1.000100 1.000200 fail no  0 no nan 1.000270 1.000570 backoff nan nan no nan nan no no 

but when try use command :

c = textscan(input_str,'%d %s %d %f %f %s %f %f %s %f %f %s %s'); 

it said "error using textscan. first input must of type double or string". when data contains 1 row, there no error. how read 2 lines correctly ?

i'm unsure caused problem - code work correctly on matlab (on version 2012b). 1 reason think of, testing textscan string rather file, , didn't add char(10) @ end of first line:

input_str = [... '0 -> 2   1.000000 1.000200 a-mpdu  1.000000 1.000100 success 1.000100 1.000200 fail no' char(10)... '0 no nan 1.000270 1.000570 backoff nan      nan      no      nan      nan      no   no']; 

(where char(10) newline character, "\n", inside actual file)

textscan works if input_str points file, i.e. input_str = fopen('t.txt');.

another possible explanation if a cell array, in case textscan doesn't know it. overcome can iterate on cells , send textscan 1 string @ time.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -