How can I use a variable to name files as a result of the command: "print"?

In a loop I plan to make 100+ files. I have a problem where I print the files to a png format. How can I use the variable "ProfielUnique(n)" in the name of the file? I have been trying a lot but can't seem to figure out how to do it. See for my code up-to-now:
plot(XmRD,YmRD,'-d');
hold on
plot(XmRDinsr,YmRDinsr,'-dr')
plot(XmRDinsl,YmRDinsl,'-dg')
axis([min(XmRD) max(XmRD) min(YmRD) max(YmRD)+8])
title(ProfielUnique(n))
xlabel('X coordinaat')
ylabel('Y coordinaat')
legend(strcat('alle meetpunten, lengte is: ',num2str(lengteprofiel), 'm'), 'rechter insteek', 'linker insteek')
filename = ProfielUnique(n);
print -dpng <what to put here? ????????????????????????????????>
hold off

Answers (0)

This question is closed.

Asked:

R V
on 5 Jul 2012

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!