Is it possible to change customization of textscans when importing data from files, in-line?
Show older comments
If I want to import the lines from a data file (shown below) with a custom delimiter - then I want to change the delimiter in-line. I'm textscanning using something like this:
fid = fopen('Test2.txt','r');
H = textscan(fid, '%s',21,'delimiter','=');
F = textscan(fid, '%f %f %f %f %f %f %f');
fclose(fid);
The problem is I would like to read in the numbers under Parameter 1 and Parameter 2 as datasets/arrays. I've tried calling them from the cell array, but the result comes out as an array of characters. Is there a way of getting those parameters out as normal arrays using textscan preferences or otherwise?
DATA
Name=Datablock 1
Date=12:02 03/09/2012
Parameter 1=32, 346, 634, 5467, 4567
Parameter 2=6.53; 7.53; 7.67; 9.01; 10.67
Offset=0
Configuration=10
Noise=0.1
Reference number=14546757
Version number=WERGXX1.0a
Alias=False
EOH
0 12341 12341234 34 7 8 446
0 12341 12341234 34 7 8 446
0 12341 12341234 34 7 8 446
0 12341 12341234 34 7 8 446
4 Comments
Walter Roberson
on 3 Sep 2012
Are there always exactly 5 values there? And are Parameter 1 and Parameter 2 always at the same place in the file?
Jan
on 3 Sep 2012
@Tolulope: It is not clear what you want to import in which format. Please post, what you expect as output for the given text file.
Accepted Answer
More 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!