Error in saving plot as PNG?
Ältere Kommentare anzeigen
for i = 3386:5100
%mkdir 8PSK
x = load(['frame_snr016QAM' num2str(i) '.mat']);
sps = 8;
eyediagram( x.frame , sps)
set(get(gcf, 'Children'), 'Visible', 'off')
cd 16QAM
pause(0.5)
saveas(gcf,['frame_snr016QAM' num2str(i) '.png']);
cd ..
close
end
error
Error using print (line 83)
PNG library failed: Write Error.
Error in saveas (line 181)
print( h, name, ['-d' dev{i}] )
I want to save the plot of eyediagram in a folder. but it was working correctly now i am facing png library failed issue. Please assist
Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 7 Okt. 2021
Bearbeitet: Walter Roberson
am 7 Okt. 2021
outdir = '16QAM';
if ~exist(outdir, 'dir'); mkdir(outdir); end
for i = 3386:5100
in_filename = sprintf('frame_snr016QAM%d.mat', i);
out_filename = fullfile(outdir, sprintf('frame_snr016QAM%d.png', i));
x = load(in_filename);
sps = 8;
eyediagram(x.frame, sps)
set(get(gcf, 'Children'), 'Visible', 'off')
pause(0.5)
saveas(gcf, out_filename);
close
end
6 Kommentare
john karli
am 7 Okt. 2021
Walter Roberson
am 7 Okt. 2021
Bearbeitet: Walter Roberson
am 7 Okt. 2021
How large is your axes (how many pixels) ?
Do you have write access to the array 16QAM ?
john karli
am 7 Okt. 2021
Bearbeitet: john karli
am 7 Okt. 2021
Walter Roberson
am 7 Okt. 2021
There is a chance that file descriptors are leaking. You could periodically
fclose('all')
but that will not help if the file descriptor is leaked inside the png library.
Which operating system are you using? If it is MacOS or Linux I might be able to suggest some tools to check file usage. Windows would take me more research.
john karli
am 7 Okt. 2021
Walter Roberson
am 7 Okt. 2021
You might be able to use Process Explorer to find out whether your process is accumulating open files;
Kategorien
Mehr zu Printing and Saving finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!