Transform a workspace variable into single .mat files
Mostrar comentarios más antiguos
Dear all,
I cut out the first and last minute of my movement data. Additionally used only a specified time window of my data. I saved my data using:
trimmed_raw_data_together = {data.acc_pelvis_time_equal}.';
However, this new workspace variable is a 9x1 cell:

I would like to save each row as one single .mat file as shown above:

Figure 1 is processed data, figure 2 is raw data. Ideally I would like to name processed data similar to the raw data (e.g. pair#1_together_processed) as an iteration.
Kind regards and thank you very much for your support an suggestions.
Jonas
4 comentarios
Matt J
el 26 de En. de 2023
Why would you want to do that? Isn't it neater and more compact to have all variables in one file?
Jonas Bender
el 26 de En. de 2023
prasanth s
el 27 de En. de 2023
to Store the specified fields of the specified scalar structure as individual variables in the file. For example, save('filename.mat','-struct','S','a','b') saves the fields S.a and S.b.
Stephen23
el 8 de Feb. de 2023
"Ideally I would like to name processed data similar to the raw data (e.g. pair#1_together_processed) as an iteration."
Ideally you would have exactly the same variable names in every MAT file, then your data importing and exporting will be simpler and much more robust than having changing variable names. By all means number the filenames sequentially, but if you want to reduce wasted time (writing code, debugging code, running code), keep the variable names constant.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Workspace Variables and MAT Files 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!
