Saveas error-Cannot create output file
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
EDOARDO BUOLI
el 4 de Nov. de 2020
Comentada: lopamudra singh
el 4 de Oct. de 2023
Hello,
i write this very simple code in MATLAB R2020b:
clear
clc
close all
x=[1 2 3 4 5];
y=x;
plot(x,y)
saveas(gcf,'Image.jpg');
But i obtain this error:
Error using matlab.graphics.internal.name (line 101)
Cannot create output file '.\Image.jpg'.
Error in print (line 71)
pj = matlab.graphics.internal.name( pj );
Error in saveas (line 181)
print( h, name, ['-d' dev{i}] )
Error in test (line 7)
saveas(gcf,'Image.jpg');
How to solve this problem? I want to save the figure in jpg format.
1 comentario
Abubakar Abba
el 11 de Sept. de 2021
It means you are trying to save a figure in an un identified path. Try to go to the actual directory and Run
the code again, it will work.
Respuesta aceptada
Bharathi Sunkara
el 5 de Nov. de 2020
Hi Edoardo,
As per my understanding, error message means, that the file “Image.jpg” cannot be created in the current folder.
This means that either this file is existing already but write-protected or in use. or you do not have write permission in the current folder.
As a workaround I would recommend you to define file names including the complete path.
Hope this Helps!
2 comentarios
lopamudra singh
el 4 de Oct. de 2023
I am running in online MATLAB and still facing the same error, where I do not have any additional folder or directory.
Más respuestas (1)
Safa Sharif
el 20 de Jul. de 2021
hi, im still getting this issue and have permission. can anyone advise why?
1 comentario
Abubakar Abba
el 11 de Sept. de 2021
It means you are trying to save a figure in an un identified path. Try to go to the actual directory and Run
the code again, it will work.
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!