2:09:17 PM,1.810
IS9.826004e-001,3.678999e-002,175.253,6.298519e+002,1.432628e+002,25.116;1.093268e+000,4.056654e-002,66.101,3.919512e+002,1.169020e+002,21.467;9.723623e-001,4.749727e-002,189.192,3.646716e+002,7.359269e+001,34.968;1.115132e+000,3.050251e-002,294.299,1.547532e+002,2.762412e+001,57.080;9.550747e-001,8.917735e-002,26.894,3.750848e+002,1.862585e+002,66.408;1.073399e+000,7.142697e-002,320.579,1.532636e+002,7.702377e+001,73.804;9.227984e-001,2.288739e-002,315.966,2.959218e+002,1.360205e+002,70.756;1.042229e+000,1.686916e-002,225.535,1.414251e+003,2.318692e+002,82.749;E655,1942,585,587;P172.600000,2533.000000T
To read this, we can do this:
Suppose we have the following dataset;
2:09:17 PM,1.810
IS9.826004e-001,3.678999e-002,175.253,6.298519e+002,1.432628e+002,25.116;1.093268e+000,4.056654e-002,66.101,3.919512e+002,1.169020e+002,21.467;9.723623e-001,4.749727e-002,189.192,3.646716e+002,7.359269e+001,34.968;1.115132e+000,3.050251e-002,294.299,1.547532e+002,2.762412e+001,57.080;9.550747e-001,8.917735e-002,26.894,3.750848e+002,1.862585e+002,66.408;1.073399e+000,7.142697e-002,320.579,1.532636e+002,7.702377e+001,73.804;9.227984e-001,2.288739e-002,315.966,2.959218e+002,1.360205e+002,70.756;1.042229e+000,1.686916e-002,225.535,1.414251e+003,2.318692e+002,82.749;E655,1942,585,587;P172.600000,2533.000000T
To read this, we can do this:
fid = fopen('Sample Data/NIR-ISS-Raw-Data-Left-Breast.txt'); % Skip the first two lines of data that may be corrupted fgetl(fid); fgetl(fid); nofdata = 1; while ~feof(fid) %Time_Stamp(nofdata) = fscanf(fid, ''); RAW_data(nofdata,:) = fscanf(fid, '%*s %*s\n%*5c%f,%f,%f,%f,%f,%f;%f,%f,%f,%f,%f,%f;%f,%f,%f,%f,%f,%f;%f,%f,%f,%f,%f,%f;%f,%f,%f,%f,%f,%f;%f,%f,%f,%f,%f,%f;%f,%f,%f,%f,%f,%f;%f,%f,%f,%f,%f,%f;E%f,%f,%f,%f;P%f,%fT\n',[1, 54]); nofdata = nofdata +1; end fclose(fid);
fscanf is a good way to read in data while the dataset is irregular. I am still trying to find an easier way to do this.
fscanf is a good way to read in data while the dataset is irregular. I am still trying to find an easier way to do this.
No comments:
Post a Comment