saving with variable name

1 visualización (últimos 30 días)
Sanjana Sankar
Sanjana Sankar el 30 de Jul. de 2019
Comentada: Sanjana Sankar el 30 de Jul. de 2019
I want to call a function twice. And this function has to save a mat file. So each time it is callled, I want to send a variable name that it must use as the name of the .mat file.
For example:
function mat_fil=(filename)
{ C = cells that i want to save;
save(filename.mat, 'C');
}
end
How do I do this?

Respuesta aceptada

Alex Mcaulley
Alex Mcaulley el 30 de Jul. de 2019
function myfun(filename,C)
save([filename '.mat'], 'C');
end

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB 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