Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Create a .mat file similar to MRI

Asked by Christopher P. on 5 May 2013
Latest activity Answered by bintoro adi on 2 Dec 2014 at 19:47

Hello,

Does anyone know how to place 12 mri images into the same matrix size and shape as D in the .mat file MRI?

Any help is greatly appreciated.

-Thanks

0 Comments

Christopher P.

Products

No products are associated with this question.

2 Answers

Answer by Youssef KHMOU on 6 May 2013
Edited by Youssef KHMOU on 6 May 2013

hi,

The default MRI sample has singleton dimension right?

try :

 % given I1,.............,I12
 [m n]=size(I1);
 M=zeros(m,n,12);
 M(:,:,1)=I1;
 %....
 M(:,:,12)=I12;
 D=zeros(m,n,1,12); 
 for n=1:12
 D(:,:,:,n)=M(:,:,n);
 end
 save Neoplasm_MRI D

10 Comments

Christopher P. on 6 May 2013

size(I1)

ans =

   225   210     3 

so the 3rd dimension is for rgb right?

Youssef KHMOU on 6 May 2013

well thats where the problem then, you have to solutions : 1) transform them into grayscale images using

    rgb2gray

2)or add a 4th/5th dimention in M/D:

   M=zeros(m,n,3,1,12) ; 
   % in the code use M(:,:,:,:,n) 
Christopher P. on 6 May 2013

Got it working.

Thank you so much for you help.

It's greatly appreciated.

Youssef  KHMOU
Answer by bintoro adi on 2 Dec 2014 at 19:47

Hi Christoper, Can u write the final code, because i still have the the same error (Subscripted assignment dimension mismatch). thank u...

0 Comments

bintoro adi

Contact us