Reorganization of experimental data
2 views (last 30 days)
Show older comments
Daniele Sonaglioni
on 30 Jul 2021
Commented: Star Strider
on 2 Aug 2021
Hello everybody,
I have a problem with the reorganization process of my experimental data.
Attached there is an example of a typical data set
0 0 -93.964 -0.00976171
1 0.001 -93.964 -0.00976627
2 0.002 -93.965 -0.00991459
3 0.003 -93.965 -0.00997991
4 0.004 -93.963 -0.0100311
5 0.005 -93.962 -0.0101206
6 0.006 -93.964 -0.0101955
7 0.007 -93.961 -0.0098519
8 0.008 -93.958 -0.00946246
9 0.009 -93.945 -0.00970383
10 0.01 -93.921 -0.0105877
11 0.011 -93.884 -0.0125595
12 0.012 -93.829 -0.015714
13 0.013 -93.755 -0.0194494
Results:
Sample:
2021_07_29_cool_variab_heat_fix_59603. 100.0000e-06 mg
Curve Name:
]61[&2021_07_29_cool_variab_heat_fix_59603
Curve Values:
Index t Ts Value
[s] [°C] [mW]
0 0 -93.205 -0.000370132
1 0.01 -93.365 -0.00237034
2 0.02 -93.578 -0.00514436
3 0.03 -93.713 -0.00678095
4 0.04 -93.800 -0.00771421
5 0.05 -93.857 -0.00846012
6 0.06 -93.893 -0.00883113
7 0.07 -93.917 -0.00909422
8 0.08 -93.932 -0.00928991
9 0.09 -93.944 -0.00943325
10 0.1 -93.949 -0.00949218
11 0.11 -93.954 -0.00950072
12 0.12 -93.957 -0.00963767
13 0.13 -93.958 -0.0096308
14 0.14 -93.960 -0.00962155
15 0.15 -93.961 -0.00964608
Results:
Sample:
2021_07_29_cool_variab_heat_fix_59603. 100.0000e-06 mg
________________________________________________________________________________
Not signed STARe SW 16.10
I want to remove all the written texts and empty lines and I want to reorganize the blocks of data in a way to invert their order.
Do you have any suggestion?
1 Comment
Accepted Answer
Star Strider
on 30 Jul 2021
Edited: Star Strider
on 1 Aug 2021
The data file you attached does not appear to bear a strong resemblance to the data file you quoted.
I chose to use textscan here because I have experience using it with files with interrupted formats, however this file appears to have no interruptions:
fidi = fopen('typical_data_set.txt','rt');
C = textscan(fidi, '%f%f%f%f %*f%*f%*f%*f%*f%*f', 'HeaderLines',1, 'CollectOutput',1);
fclose(fidi);
M = cell2mat(C);
Here ‘M’ is a (44006x4) double array.
A file with interruptions would simply require a while loop to loop through it, saving the individual sections. For an example, see: How to skip lines of Data in the middle of a text file . I believe that file was similar to the one you quoted.
EDIT — (1 Aug 2021 at 00:15)
Removed the generic code example. Nothing else changed.
.
14 Comments
More Answers (1)
See Also
Categories
Find more on Text Data Preparation 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!