Imwrite with changing title
Afficher commentaires plus anciens
Hi there, I am looking for help with using the imwrite function.
I have a string that changes when I put different values in the function.
[xCentroid,yCentroid]= Centroid(Beam)
ImLabel = sprintf("a= %.2f,b= %.2f,x= %.2f,y= %.2f,xBar= %.2f,yBar= %.2f,amplitude= %.2f,xCentroid: %.2f, yCentroid: %.2f",a,b,x,y,xBar,yBar,amplitude,xCentroid,yCentroid)
This creates this string: "a= 70.00,b= 10.00,x= 300.00,y= 300.00,xBar= 150.00,yBar= 150.00,amplitude= 250.00,xCentroid: 149.32, yCentroid: 150.18"
The numbers change how I want them to.
How do I have it so that whenever I run the program it saves in a folder? I have tried adding .jpg to the end of this string. No changes.
The rest of the code is as follows:
img = getframe(gcf);
fullFileName = fullfile(folder,ImLabel);
imwrite(img.cdata,fullFileName,'jpg')
At the moment it doesnt work unless I change ImLabel to something simple eg 'Test.jpg'.
Cheers,
Ollie
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Images dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!