- To make the figures not appear, I'd set their Visible property to 'off'
- I'd also recommend exportgraphics on releases since 2020a.
- Your code executes fine, but it's plotting bunch of ones vs. ones, and plot defaults to no marker, so there's nothing visible in the plot. If you're getting an error, of course it's helpful if you tell us what it is...
Save figures from for loop into a subfolder of the current folder.
47 views (last 30 days)
I will use math notation instead of saying arrays etc. In what follows and . I want to plot each column of X against y on separate figures and save these figures as png files to a subfolder in my current folder called "Figures". I want each figure to be saved with the name 'ploti ' for each . When I run the code I dont want the figures to appear just to directly save into the file for me to view later.
This is my current script for example :
But I get erros I think it is coming from my use of saveas but I spent ages trying to work out how to do it and the documentation on saveas was not very usefull. Moreover, the figures always open when I run the code (which I dont want). Can anyone show me how they would do it ?
Dave B on 9 Nov 2021
for i = 1:3
f = figure('Visible','off');
exportgraphics(f,"foo" + i + ".png")