Saving mat file named by a variable and comprising multiple variables to a different folder

1 次查看(过去 30 天)
Hi,
I have spent a few hours now trying to get my head around a problem that seems simple but the implementation is eluding me. I run a long script which creates some variables I wish to save for further work with another script. The input data files I use to extract a filename, which I want to use to name the mat file I create, this I can do no problem, just I want to save it to a different folder within the same script. I have looked at full file and save documentation and numerous close but not quite answers on here.
%this what I use to save the mat file
save(char(PhID),'PHdataOUT','TI','RawDataOutputArray')
%it gives me a mat file correctly titled and comprises the three variables %'PHdataOUT','TI','RawDataOutputArray'
The path i want is something like '/Users/mainfolder/Desktop/subfolder/database/' but i cannot figure out how to adapt either file parts or full file to get this mat file where it needs to go. Any ideas?

采纳的回答

KL
KL 2017-5-16
f = fullfile('myfolder','mysubfolder',char(PhID))
save(f,'PHdataOUT','TI','RawDataOutputArray')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Low-Level File I/O 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by