To save plots without showing them on the screen
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Vahid Esmaeili
am 2 Mai 2022
Kommentiert: Vahid Esmaeili
am 5 Mai 2022
Hello.
The following code is supposed to plot a variable and save it in an EXCEL sheet. I am running a series of codes for biomechanical analysis of gait with about 500 plots that must be saved in one EXCEL sheet. It means for each sheet, I have to wait for a plot and save this plot in the EXCEL sheet. It is time taking and needs memory becasue MATLAB has to show 500 plots on the screen and save them in the EXCELL document!
figure;
for k=1:length(mN(:,1))
plot(mN(k,:),'g')
hold on
end
plot(mN,'b','linewidth',2)
title ('Healthy_Right');
writetable(table(ccc, ddd), 'Biomechanics_PT_Pre','WriteVariableNames', true);
xlswritefig(gcf, 'Biomechanics_PT_Pre', 'CV_BOSlenRRLL', 'B20');
Using %, I deactivated the plot command. However, MATLAB saved the plots in the EXCEL sheet without any curves!!! As an amateur, I asked MATLAB to close the plots (using the "close all" command) after saving the plot in the EXCEL sheet but I know it is not a good way. Is there any way to directly save the plots in the EXCEL document without showing them on the screen? Would you please assist me to improve the speed of this process? Please assist me with this issue.
Sincerely,
0 Kommentare
Akzeptierte Antwort
Alberto Cuadra Lara
am 2 Mai 2022
Hi Vahid,
Just set the property 'visible' of the object figure to 'off'.
f = figure('visible','off');
hold on
for k=1:length(mN(:,1))
plot(mN(k,:),'g')
end
plot(mN,'b','linewidth',2)
title ('Healthy_Right');
writetable(table(ccc, ddd), 'Biomechanics_PT_Pre','WriteVariableNames', true);
xlswritefig(gcf, 'Biomechanics_PT_Pre', 'CV_BOSlenRRLL', 'B20');
3 Kommentare
Alberto Cuadra Lara
am 4 Mai 2022
Bearbeitet: Alberto Cuadra Lara
am 4 Mai 2022
Hi Vahid,
You are not using the same function. "xlswrite" is not recommended. Use writetable as in the first case. Btw, "xlswritefig" is a function you created, right?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Bar Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!