how to create a mat file of a given image with the same file name?
7 ビュー (過去 30 日間)
古いコメントを表示
t=imread('a.jpg') is the code. my output mat file should be a.mat what is the code.
0 件のコメント
回答 (2 件)
Lisa Wu
2013 年 5 月 10 日
編集済み: Walter Roberson
2023 年 7 月 23 日
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 件のコメント
Yao Li
2013 年 5 月 10 日
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 件のコメント
Stephen23
2023 年 7 月 23 日
"is it mandatory to remove the jpg extension?"
No.
"If yes... then how to remove it?"
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!