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에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by