save で保存先を変数指定する方法

name="alpha"
mkdir(name)
こうすると、現在のフォルダ内にalphaというフォルダが作成されるかと思います。
このalphaの中にsaveコマンドを使い、zeta.matを保存したいです。
通常、『save zeta』でzeta.matが現在のフォルダーに作成されるところを、alphaの中に入るようにできますか?

 채택된 답변

madhan ravi
madhan ravi 2018년 10월 25일

3 개 추천

%get the directory of your input files:
pathname = fileparts('/input/file');
%use that when you save
matfile = fullfile(pathname, 'output.mat');
figfile = fullfile(pathname, 'output.fig');
save(matfile, ...');
saveas(figfile, ...');

댓글 수: 1

madhan ravi
madhan ravi 2018년 10월 25일
the above shows an example

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

NAKAI TAKUYA
NAKAI TAKUYA 2018년 10월 25일

0 개 추천

Thank you!!

카테고리

태그

질문:

2018년 10월 25일

댓글:

2018년 10월 25일

Community Treasure Hunt

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

Start Hunting!