Generating and assigning filename from one dimensional matrix to plots and saving the plots automatically

1 view (last 30 days)
I'm having a one dimensional row matrix.Its each cell contains a string of form RF-II-1 ,RF-II-5 etc.I have to generate plot using some variable lets say X and Y and save these plot automatically using the filename from each cell of the 1-d matrix.I have tried using saveas and print commands but none of them seem to work .Is there any method to solve this problem??
for i=1:10
saveas(h,matrix(i),'jpg')
end

Accepted Answer

the cyclist
the cyclist on 25 Sep 2015
So, if you made the filename "by hand", it would be
filename = 'RF-II-1.png'
and you have the cell array
matrix = {'RF-II-1', 'RF-II-5', ...}
so I think you want
filename = [matrix{1},'.png']
and therefore
saveas(h,[matrix{1},'.png'])
which in the loop could be
saveas(h,[matrix{i},'.png'])

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!