Sir I have 15 images ,I want to create .mat file so that i can load these images easily,please tell how to create .mat file

 채택된 답변

Wayne King
Wayne King 2011년 10월 7일

0 개 추천

1.) If the images are the same size you can put them in an array and save that. If different, use a cell array.
2.) You can use matfile() to create a writable .mat file, save data into it, and then load that.
matobj = matfile('c:\data\mymat','Writable',true);
matobj.image1 = randn(256,256);
matobj.image2 = randn(256,256);
loadimage1 = matobj.image1;
% or
load('mymat.mat','image1');

댓글 수: 5

FIR
FIR 2011년 10월 7일
sir ,cant understand this method,can u suggest some other method please
Wayne King
Wayne King 2011년 10월 7일
Hi, What can't you understand? Another thing you can do is clear everything in your workspace except the 15 images and use save to save the whole workspace (which contains only the 15 images). I recommend the matfile() approach though
FIR
FIR 2011년 10월 7일
thank u sir,and other question which i have posted,I have aroung 15 slices of images,is it possible to create a single imaged from those slices of images
Image Analyst
Image Analyst 2011년 10월 7일
Single image how? Tiled, like with the montage() function? Or stacked into a volumetric 3D image like with cat(3, .....)?
FIR
FIR 2011년 10월 7일
sir ,it is stacking of an 15 slices image into one,is it possible

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Wayne King
Wayne King 2011년 10월 7일

1 개 추천

Yes, you can create an image volume. Create a 3-D array and place the images in that array.
X = zeros(256,256,15);
X(:,:,1) = image1;
X(:,:,2) = image2;
and so on

댓글 수: 3

FIR
FIR 2011년 10월 7일
sir ,but i need only one from from those 15 images forming a cube
Zoe
Zoe 2017년 10월 28일
Hi Wayne, is there a way to do it in a loop?? I have around 400 hundred matrices in my workspace and I want to store them in a 3d array. Thank you.

댓글을 달려면 로그인하십시오.

질문:

FIR
2011년 10월 7일

댓글:

2017년 10월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by