how to Create a mat file for images

조회 수: 1 (최근 30일)
Sharen H
Sharen H 2015년 4월 10일
댓글: Image Analyst 2015년 4월 12일
i have 15 images say x1=[1 2
3 4 ]
similarly x2 =[5 6
3 4 ] , x3 till x15
first i want these to be converted to x1= [ 1
2
3
4]
similarly other matrixes also.
i want to save a mat file called
dark = [ 1 6
2 7
3 3
4 4]

채택된 답변

Image Analyst
Image Analyst 2015년 4월 10일
A mat file called what?
Anyway, to save those variables:
save(matFileName, 'x1', 'x2, 'x3', 'x4', ...
'x5', 'x6', 'x7', 'x8', ...
'x9', 'x10', 'x11', 'x12', ...
'x13', 'x14', 'x15', 'dark');
  댓글 수: 4
Sharen H
Sharen H 2015년 4월 12일
my data is i have 15 images of size mxn which has to be converted to 1 x m*n matrix .
then i have to save these in the form of mat file having 15 x m*n matrix. can u
help me to do this in way where i have to call and save using loop because my data
gets increases as it goes on. thanks in advance
Image Analyst
Image Analyst 2015년 4월 12일
Try this:
x1 = x1(:); % Convert to 1-D
x2 = x2(:); % Convert to 1-D
... etc.
x15 = x15(:); % Convert to 1-D
dark = dark(:); % Convert to 1-D
% Now save them all into a single mat file.
save(matFileName, 'x1', 'x2, 'x3', 'x4', ...
'x5', 'x6', 'x7', 'x8', ...
'x9', 'x10', 'x11', 'x12', ...
'x13', 'x14', 'x15', 'dark');

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by