How can i write formatspecififcation regarding to amount of my line?

1 view (last 30 days)
Now i am reading like txt files .first Comes Parameters than values. Every measurement file have different number of values that's why formatSpecification changes. Exmaple:
formatSpec4 = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%........%[^\n\r]';
(s* amount of-line) how can i define my format specification regarding to line number?
  7 Comments
cemsi888
cemsi888 on 5 Mar 2015
i can create desired amount of s and combined[^\n\r] but when i want read datas it gives me error.
Wertepar = textscan(fid1, formatSpec, lines-Gesamtzeile{1,1}, 'Delimiter', delimiter1, 'HeaderLines', Gesamtzeile{1,1}, 'ReturnOnError', false)´
program assume that formatspec ist just= %s
i used debug and wrote
a=fprintf('[^\\n\\r]',formatspec)
it gives me as a result 7.than i used num2str to convert number to string however it does not work too...
Adam
Adam on 5 Mar 2015
If the formatspec is a string why are you calling num2str on it?

Sign in to comment.

Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!