How to write out multiple mat files, for some kind of regression suite testing?

1 vue (au cours des 30 derniers jours)
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?

Réponse acceptée

Iman Ansari
Iman Ansari le 16 Avr 2013
Modifié(e) : Iman Ansari le 16 Avr 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

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by