Saving structures from each iteration into a structure? Good idea? How?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
The code below goes through a list of filenames and for each one run all three functions. Each function returns a structure of variables. I'm looking to store each version of the structures from each filename iteration in a structure. Is this suitable and/or possible? Previous tries have not worked well.
for a = 1:length(s_filename_list);
data_filename = s_filename_list{1,a};
prefs = sensor_preferencesG(pref_filename);
[outputA,glider_eng] = sensor_processingAG(data_filename,prefs,eng_filename,a);
outputB = sensor_processingBG(prefs,outputA);
end
0 comentarios
Respuestas (1)
David Young
el 11 de Ag. de 2015
Not sure what you've tried already and had problems with, but I'd have thought it was as simple as putting the results into structure arrays. So to keep all the "output" structs you'd just do:
for a = 1:length(s_filename_list);
data_filename = s_filename_list{1,a};
prefs = sensor_preferencesG(pref_filename);
[outputA(a),glider_eng] = sensor_processingAG(data_filename,prefs,eng_filename,a);
outputB(a) = sensor_processingBG(prefs,outputA(a));
end
It's possible to preallocate the structure arrays to shave a little off the time, but it's probably not worth worrying about doing that.
0 comentarios
Ver también
Categorías
Más información sobre Structures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!