How to write out multiple mat files, for some kind of regression suite testing?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
It will much easier to understand, if I use an example to demonstrate the problem I have :
Diff_Freq_Array = [5, 8, 10, 12, 14];
for i = 1: length(Diff_Freq_Array)
Freq = ((Diff_Freq_Array(i)) .* ones(1, 1000));
Phase = cumsum(Freq);
save ('output_variables', '-mat');
end
So, as described above in the script, I want to generate different frequencies as per the given numbers in the Diff_Freq_Array i.e. 5 hz, 8 hz, 10 hz and so on. Every-time this for loop is executed I want to save a different mat file (with a different name) for only that particular run. So at the end of the run, I should have total of 5 mat files for 5 frequency values in the Diff_Freq_Array. Please provide any insight, how to achieve that?
0 comentarios
Respuesta aceptada
Iman Ansari
el 16 de Abr. de 2013
Editada: Iman Ansari
el 16 de Abr. de 2013
Hi
Diff_Freq_Array = [5, 8, 10, 12, 14];
for i = 1: length(Diff_Freq_Array)
Freq = ((Diff_Freq_Array(i)) .* ones(1, 1000));
Phase = cumsum(Freq);
name=['output_variables_' num2str(Diff_Freq_Array(i))];
% or
% name=sprintf('output_variables_%d',Diff_Freq_Array(i));
save (name,'Phase','Freq');
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!