what is the meaning for variable of .mat file
Show older comments
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');
Accepted Answer
More Answers (2)
Soon Fei Fong
on 8 Mar 2015
0 votes
1 Comment
Image Analyst
on 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
on 9 Mar 2015
0 votes
Categories
Find more on Read, Write, and Modify Image 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!