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

Thread Subject:
reshape 3D matrix to 2D matrix

Subject: reshape 3D matrix to 2D matrix

From: Hermano Cappa

Date: 3 Dec, 2011 13:27:10

Message: 1 of 2

Hi,

How can I reshape the following 3D matrix into a 2D matrix?

A=cat(3,[1 2],[3 4])

A(:,:,1) =

     1 2


A(:,:,2) =

     3 4

I want this 3D matrix in the following format

B = [1 2; 3 4]

How can I do this without using a loop?

Subject: reshape 3D matrix to 2D matrix

From: james bejon

Date: 3 Dec, 2011 13:53:07

Message: 2 of 2

Not too sure how general you need this to be, but in this case at least:

permute(A, [3 2 1])

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us