From: Marlene Ferrier on
Hi,

I would like Matlab to save data in a file whose name would contains some of the simulations parameters

For instance, let's say I run simulations at various temperaturesT and pressures P,
Can MAtlab automatically save the data in files whose name would be T_ 20_P_1 ,T_ 40_P_1, T_ 60_P_1....

So far to save my data I use:
save file_name result1 result2 and change the file_name everytime I run my code..

Quite tedious

Thanks for your help
From: Jean-Luc Dellis on

>
> For instance, let's say I run simulations at various temperaturesT and pressures P,
> Can MAtlab automatically save the data in files whose name would be T_ 20_P_1 ,T_ 40_P_1, T_ 60_P_1....


Try to construct string like:

myfile=['data_T',num2str(t),'_P',num2str(p)];
save myfile
From: us on
"Marlene Ferrier" <marlene.ferrier(a)gmail.com> wrote in message <ht08i8$q9l$1(a)fred.mathworks.com>...
> Hi,
>
> I would like Matlab to save data in a file whose name would contains some of the simulations parameters
>
> For instance, let's say I run simulations at various temperaturesT and pressures P,
> Can MAtlab automatically save the data in files whose name would be T_ 20_P_1 ,T_ 40_P_1, T_ 60_P_1....
>
> So far to save my data I use:
> save file_name result1 result2 and change the file_name everytime I run my code..
>
> Quite tedious
>
> Thanks for your help

a hint:
- to create file names

help sprintf;

http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_process_a_sequence_of_files.3F

- to save them

save(fnam,'...',...);

http://matlabwiki.mathworks.com/MATLAB_FAQ#How_do_I_dynamically_generate_a_filename_for_SAVE.3F

us