Sorting a cell containing a set of structures?
Mostrar comentarios más antiguos
Hello everyone,
I am currently working on my final-year individual project at university, where I'm doing a potentially large array of experimental tests (in a wind tunnel). I would like to then organise all my data for post-processing.
As things stand for the moment, this is how I've set up my post-processing in Matlab:
-> output from WT tests in the form of an excel file -> all excel files moved to one location -> list of excel files read
I then create a cell named dat, in which I create a structure for each experiment I conduct, meaning this is the structure of my code:
for i=1:length(excelList)
dat{i}.R=excelList(i).name(4);
dat{i}.M=xlsread(excelList(i,1).name);
dat{i}.var1=dat{i}.M(...);
dat{i}.var2=dat{i}.M(...);
dat{i}.var3=dat{i}.M(...);
end
In the code posted above, the variable R is a string containing the number of the run (i.e. run 1, run 2, etc) for which I'm storing data in cell i of dat.
This is where I've hit a snag. As my different runs represent a chronological evolution configurations, I'd like my cell (dat) to store my data with run 1 being the first structure in the cell, run 2 the second structure, and so on.
I've so far found methods of sorting a cell, as well as methods to sort a structure, but none that sort a cell of structures on a given field in the structures (in this case, R).
Can anyone shed some light on whether this is even possible, and if it turns out to be possible, point me towards a possible way of accomplishing it?
All your help is much appreciated.
Cheers, -KN
Respuesta aceptada
Más respuestas (1)
Karim N
el 23 de Jun. de 2013
0 votos
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!