Why can't I save this structure as a .mat file?

12 visualizaciones (últimos 30 días)
Kyle J
Kyle J el 18 de Ag. de 2017
Comentada: Kyle J el 18 de Ag. de 2017
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?

Respuesta aceptada

Matt J
Matt J el 18 de Ag. de 2017
Editada: Matt J el 18 de Ag. de 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.

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by