how to automatically create "smart" files names

  • Follow


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
0
Reply Marlene 5/19/2010 8:47:04 AM

> 
> 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
0
Reply Jean 5/19/2010 9:58:03 AM


"Marlene Ferrier" <marlene.ferrier@gmail.com> wrote in message <ht08i8$q9l$1@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
0
Reply us 5/19/2010 10:05:05 AM

2 Replies
307 Views

(page loaded in 0.024 seconds)

Similiar Articles:













7/27/2012 6:53:58 PM


Reply: