How to save something?

조회 수: 5 (최근 30일)
Mr M.
Mr M. 2015년 9월 4일
댓글: dpb 2015년 9월 4일
From a script I used to use something like this:
cd(fileparts(which(mfilename)));
save([mfilename,'_data.mat']);
However I think this is very crude. It is not possible to change directory to the current script by default?
But my problem is how to save from the Command Window, when there is no script, just a loaded .mat file for example.
>> save('p.mat')
Error using save
Unable to write file p.mat: No such file or directory.
>> cd(fileparts(which(mfilename)));
Error using cd
Cannot CD to (Name is nonexistent or not a directory).
  댓글 수: 1
dpb
dpb 2015년 9월 4일
What does
cd
matlabpath
return at the command line?
I can't get the above to fail so the issue is one of being in a write-protected subdirectory or trying to access a non-accessible networked drive or somesuch, not Matlab issue, per se...

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Search Path에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by