I want to save an image from a designated axes. I keep getting You may not have permission to write error. Here is my code for the save as push button:
axes(handles.axes3);
[FileName, PathName] = uiputfile('*bmp', 'Save As');
Name = fullfile(FileName, PathName);
imwrite(handles.TReg, Name, 'bmp');
Also, handles.TReg is a transformed image defined on another function.
I cannot seem to find my error here, any thoughts would be appreciated.
Edit
If I use the code:
axes(handles.axes3);
[FileName, PathName] = uiputfile('*bmp', 'Save As');
Name = fullfile(FileName, PathName);
imwrite(handles.TReg, 'Name', 'bmp');
The file will save as Name.bmp in the proper directory. However I did notice that when I try saving with the original code, the error also reads (I missed this bit sorry):
Can't open file "Image1\C:\Users\Shinobii\Documents\MATLAB\" for writing.
I think the pathname should read like
"C:\Users\Shinobii\Documents\MATLAB\Image1"
could this be the problem?
Small mistake:
Also its a good idea to check that the user didn’t cancel the dialog box: