Each time i run my simulation i get the error attached below. Please help

1 view (last 30 days)
Please see the attached image.

Accepted Answer

OCDER
OCDER on 13 Sep 2018
Are you using cd, change directory, anywhere in your code to go to that Program File folder? What is your current working directory, when you type cd ?
Change your current working directory to one where you have permission to create files.
WorkDir = 'c:\Users\user_name\Desktop\MyFolder'; %Your working directory
if ~exist(WorkDir, 'dir')
mkdir(WorkDir) %Make sure you do have a directory
end
cd(WorkDir)
run your code now
The better solution is to find the code where you are trying to write files, and make sure to use the FULL FILE PATH, and not relative file path.
For instance,
plot(1:10, 1:10)
[FileName, FilePath] = uiputfile('*.png');
saveas(gcf, FileName) %will save to current working dir
saveas(gcf, fullfile(FilePath, FileName)) %will save to an exact location

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!