how to create a mat file of a given image with the same file name?
Mostrar comentarios más antiguos
t=imread('a.jpg') is the code. my output mat file should be a.mat what is the code.
Respuestas (2)
Lisa Wu
el 10 de Mayo de 2013
Editada: Walter Roberson
el 23 de Jul. de 2023
t = imread('a.jpg ');
save('a.mat','t'); % save the varible t to a.mat
Usage of function SAVE is :
save (FILENAME ,VARIABLES)
and both filename and varible should be a string ,
for example ,filename shoule be 'filename.extension ';
Know more about SAVE ,you can type Help save in command window
2 comentarios
Sivakumaran Chandrasekaran
el 10 de Mayo de 2013
Pooyan Rezaeipour
el 23 de Jul. de 2023
Thank you very much!
Yao Li
el 10 de Mayo de 2013
0 votos
try
strcat()
to define the name of the mat file
For example, filename='a';
matfilename=strcat(filename,'.mat');
save(matfilename,'t');
You may also have to create a function to remove the extension of the figure name (.jpg)
2 comentarios
Sivakumaran Chandrasekaran
el 10 de Mayo de 2013
Stephen23
el 23 de Jul. de 2023
"is it mandatory to remove the jpg extension?"
No.
"If yes... then how to remove it?"
Categorías
Más información sobre Get Started with MATLAB en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!