Why does the SAVEAS function return an "Invalid or missing path" error when I specify a directory name which has the same name as a built-in function in MATLAB 6.5 (R13)?

For example, create a directory whose name is "norm", then type at the MATLAB command prompt:
gcf;
saveas(gcf,'norm/A.png');
This produces the error:
>>??? Error using ==> saveas
Invalid or missing path: norm/A.png
Now enter the commands:
saveas(gcf,'nor/A.png');
dir nor
This produces the result
>> . .. A.png
The file was succesfully saved.

 Accepted Answer

This bug has been fixed in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
We have verified that there is a bug in MATLAB 6.5 (R13) that affects the way the SAVEAS function operates when using a directory that has the same name as a MATLAB built-in function.
To work around this issue, you can include in the SAVEAS input argument the directory’s absolute path rather than just the directory name. This causes MATLAB to recognize the input argument as a directory and not as a function name. For example:
gcf
saveas(gcf,'$MATLAB\work\norm\A.png');
where $MATLAB is the MATLAB root directory on your machine, as returned by typing
matlabroot
at the MATLAB command prompt.

More Answers (0)

Categories

Products

Release

R14SP2

Community Treasure Hunt

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

Start Hunting!