In the workspace I have many m-files containing data I'd like to plot. I have to read them all and save their plot without showing the results (I'll see them after all is done). The last part can be done this way?
f = figure('Visible', 'off');
plot(x,y);
saveas(f,'figure.fig');
but I don't want to load manually each m-file where x and y are stored. So I need a way to explore the filesystem and run these statements for each file, manipulate their name and save a jpg with the same name of its m-file.