Problem by saveas plot
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
CSCh
el 20 de Dic. de 2020
Respondida: Image Analyst
el 5 de En. de 2021
Hi everyone, I do not understand what I'am doing woring in saving my plot.
My code:
Temp=[num2str(vaiable), 'Myplotnumber' ,num2str(n) ,'-dpng'];
saveas(gcf,Temp);
it save the figure always with Var1Myplotnumber2.png.fig
why put matlab .fig at the end?
Thank you?
3 comentarios
Respuesta aceptada
Más respuestas (3)
Image Analyst
el 20 de Dic. de 2020
Use exportgraphics() instead if you have R2020a or later.
7 comentarios
Image Analyst
el 21 de Dic. de 2020
I don't know. You never showed me your exportgraphics() code that didn't work. You only showed it where it worked in the command window with a hard-coded filename string. Please post the non-working code from your m-file. Apparently it thinks your Temp did not have an extension on it. Are you sure Temp ends in '.png'?
Walter Roberson
el 21 de Dic. de 2020
Temp = {sprintf('%dMyplotnumber%d.png', vaiable, n),'-dpng'};
saveas(gcf, Temp{:})
0 comentarios
Image Analyst
el 5 de En. de 2021
You can do
baseFileName = sprintf('%d Myplotnumber %d.png', variable, n); % Name without folder.
fullFileName = fullfile(yourFolder, baseFileName); % Prepend folder.
saveas(gcf, fullFileName);
0 comentarios
Ver también
Categorías
Más información sobre Printing and Saving 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!