how can I save multiple files

24 visualizaciones (últimos 30 días)
erfan rezaei
erfan rezaei el 14 de Feb. de 2020
Respondida: Star Strider el 14 de Feb. de 2020
Hi
I have 116 different .mat file with different name according to their sequence, and all of them have same variables(numbers between 0 to 1). When I save them by using sprintf and the name of 1.mat 2.mat ... 116.mat, "save" function saves each of these 116 mat file, but each of them contains 115 others. For example 1.mat contains 1.mat until 116.mat and 116.mat also contains 1.mat until 116.mat!!!!
But I need to save each .mat related to just its number not the others. What should I do?
for i = 1:116
n = sprintf('%d.mat',i);
save(n);
end

Respuestas (1)

Star Strider
Star Strider el 14 de Feb. de 2020
Tell save exactly what you want it to save.
See the documentation section on: Save Specific Variables to MAT-File for details.

Categorías

Más información sobre Workspace Variables and MAT-Files 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!

Translated by