Why can't I save this structure as a .mat file?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm trying to save a structure with several fields in matlab. The following lines save the data to the desired folder:
filename_output = [outpath subf(k).name '_timeseries.mat'];
save(filename_output,'-struct','my_structure');
But when I try to load the structure with:
load(filename_output)
I get a bunch of separate variables, not in a structure. Am I overlooking something?
0 commentaires
Réponse acceptée
Matt J
le 18 Août 2017
Modifié(e) : Matt J
le 18 Août 2017
You did not save a structure. The '-struct' option splits the fields of my_structure into separate variables before saving. However, it is best practice anyway to call load() with an output argument,
myStruct = load(filename_output)
and when you do you obtain your variables again in structure form.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Structures dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!