Azzera filtri
Azzera filtri

Matlab R2018a does not save the whole figure

12 visualizzazioni (ultimi 30 giorni)
Hello,
I am working on some scripts that use this function (with some modifications). While the script is running the figure appears as expected. But when I export it, some parts of it are missing. I have tried
print(gcf, namem,'-dtiffn','-r600')
as well as manual export via the GUI. I keep getting the exact same parts cropped. What could be the issue? This is the 1st time facing such a weird problem.
  2 Commenti
BN
BN il 21 Gen 2020
Modificato: BN il 21 Gen 2020
I have the same problem a few weeks ago. I told you what I've done, maybe useful for you. I'm worked with Matlab R2018b.
I was saved my work and close Matlab, then Restart the computer. after that I use:
clear all
close all
clc
Then I run my code from the first part again. After that everything was fixed for me.
I was saving the figure using this command:
DirectoryPath ='C:\Users\Behzad\Desktop\Figures';
whereToStore=fullfile(DirectoryPath,['filename', '.png']);
saveas(gcf, whereToStore);
I hope it helps you because I have exact same problem and it worked for me.
Also you can use export_fig instead of print.
BN
BN il 21 Gen 2020
Dear Orestis,
Acording to mac question, I think using this two line code the problem would be fix.
fh = figure() %your figure
set(fh, 'Visible','off');

Accedi per commentare.

Risposta accettata

Orestis Stylianou
Orestis Stylianou il 22 Gen 2020
I just tried
fh = figure() %your figure
set(fh, 'Visible','off');
still no luck
  1 Commento
Orestis Stylianou
Orestis Stylianou il 22 Gen 2020
Modificato: Orestis Stylianou il 22 Gen 2020
So I spent a bit more time on this. By using the export_fig cutom function I can go up to a dpi of 432, after that parts of the image start missing. With using the usual print function that it was origianlly in my script and setting dpi to 522 I have no problem. When I set it to 523 pieces start missing. The higher the dpi, the larger the missing part is. 522 vs 600 dpi is not a big difference and it is sufficient enough but what is the cause of that?
EDIT: I had to set the renderer to painters and now it works just fine
print(gcf,namem,'-dtiffn','-r600','-painters');
Thanks :)

Accedi per commentare.

Più risposte (1)

Orestis Stylianou
Orestis Stylianou il 21 Gen 2020
Hi! I will try the function. I already restarded my PC a couple of times but it doesn't seem to work.

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by