invalid filename saving figure

17 Ansichten (letzte 30 Tage)
Rose
Rose am 24 Aug. 2022
Kommentiert: Walter Roberson am 25 Aug. 2022
I am trying to save this figure using the following code, however I keep getting the error "invalid filename".
Str2 consists of a combination of text and values, to create a unique name, corresponding to the figure at hand. However, something, somewhere goes wrong. I have tried to remove the .png and add it to the saveas command. I have tried to name my figure, like f=figure(), but I cannot discover my error. Any solutions?
figure(2)
hold on
plot(output_time,Principal_stress_fatigue_fy_mx/10^6)
ylabel('equivalent stress [MPa]')
xlabel('time [s]')
grid
str2="Figure2"+ VTRIM + bank_angle + roll_rate + AC_mission_type(j)+".png"
saveas(gcf,str2)
  10 Kommentare
Rose
Rose am 25 Aug. 2022
it works! Thank you!
Walter Roberson
Walter Roberson am 25 Aug. 2022
Odd. You filled out R2021a as your release, but string() was supported for that parameter in R2021a. R2017a was the last release that did not support string() for that parameter.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Printing and Saving finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by