save more than one image in a matfile

2 次查看(过去 30 天)
i select an image from a folder and save it in a matfile..... then i load the matfile and display the image.....
[filename pathname]=uigetfile('*.tif','Select An Image');
inputImage=imread([pathname filename]);
save imageMatfile inputImage
how to save more than one image in the same matfile(not all images in folder, but only those i want).......using these select statements is it possible???...... please do reply....

采纳的回答

Walter Roberson
Walter Roberson 2013-2-4
for K = 1 : 10
[filename pathname] = uigetfile('*.tif','Select An Image');
inputImages{K} = imread(fullfile(pathname, filename));
end
save imageMatfile inputImages
  4 个评论
Jan
Jan 2013-2-4
Whenever you do not know the syntax of a command, simply look at the documentation: help save and doc save.
Walter Roberson
Walter Roberson 2013-2-4
If you have a new enough version of MATLAB, you can use matfile() to store additional array elements into an array stored in a .mat file.
You can use -append to store additional information into a .mat file, but you need to use a different variable name each time or else the existing content with that variable name will get overwritten.

请先登录,再进行评论。

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-2-4
Saving your first image
im1={imread('first_image')}
save yourfile im1
Adding a new image
im1=imread('news_image')
im=load('yourfile')
im1=im.im1
im1{end+1}
save yourfile im1
  4 个评论
Elysi Cochin
Elysi Cochin 2013-2-4
sir but i'm getting this error...
??? Cell contents reference from a non-cell array object.
Error in ==> Untitled at 19
imshow(im1{k})
Azzi Abdelmalek
Azzi Abdelmalek 2013-2-4
编辑:Azzi Abdelmalek 2013-2-4
Have you used?
im=load('yourfile')
and when saving the first image
im1={imread('first_image')}

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by