Matlab saving figure with file name containing variables -


i have no idea how save file when name contains variables.

a = figure();  % code  filename = sprintf('sig1=%d mu1 =%d p1=%.2f sig2 = %d mu2 = %d p2 = %.2f', ...                      sigma1, mi1, double(p1), sigma2, mi2, double(p2));  print(a, filename, '-dpng'); 

i got work:

a = figure; plot(1:10,sin(pi*(1:10)./4))  filename = sprintf('sig1=%d mu1 =%d p1=%.2f sig2 = %d mu2 = %d p2 = %.2f.png', ...                      1, 2, double(3), 4, 5, double(6));  print(a, filename, '-dpng'); 

the png file opened fine. when want png file name have variables in it, correct approach. can set lot more figure specifications using figure handle ("a", in case) , set(a,...) function. @ matlab documentation using set(a,...) function , gcf. if type get(a), see list of properties can set before save figure.

please let me know if helps.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -