How can I force MatLab to display integers in function sprintf ?
Show older comments
Hi,
I would like to save graphs in a loop and use sprintf to change the file names, but don't want to have decimal places because this destroys the file extension. The loop is:
for i=1:5
x = [0 ; 0.44; 1.1; -1,1; -0.44];
sprintf('Graph %2d.png',x(i)*100)
end
When I use x(3) =1.1 sprintf('Graph %2d.png',x*100) gets displayed as " Graph 1.100000e+02 ". The same problem does not occur with sprintf('Graph %2d.png',110). If x = 0.44 is also works fine. How can I force MatLab to display integers for every number?
Thanks for your help!!
Accepted Answer
More Answers (1)
Devaraja Lakshmanappa
on 3 Mar 2015
0 votes
I had used mprintf function in my program,but i am getting error saying this function is not there in matlab7.0.2.
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!