what is the meaning for variable of .mat file
Afficher commentaires plus anciens
Hi, I have two colour image in .jpg. How can I convert them into 1 .mat file with only 1 variable like 2x28x28 array.
here is the code that i have try, but it generate 2 variable as below

- pic1 = imread('image_0001.jpg');
- pic1 = imresize(pic1, [28, 28]);
- pic2 = imread('image_0002.jpg');
- pic2 = imresize(pic2, [28, 28]);
- save('BothPics.mat', 'pic1', 'pic2');
Réponse acceptée
Plus de réponses (2)
Soon Fei Fong
le 8 Mar 2015
0 votes
1 commentaire
Image Analyst
le 8 Mar 2015
You can save things in a structure array and save that.
allImages(1).pic = pic1;
allImages(2).pic = pic2;
% and so on...
save('mydata.mat', 'allImages')
Soon Fei Fong
le 9 Mar 2015
0 votes
Catégories
En savoir plus sur Read, Write, and Modify Image 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!
