user602774
user602774

Reputation: 1103

matlab drop 3rd dimension of a array and assign it to a 2d array

I have a 3 dimensional array. I want to assign only the first two dimensions to a 2D array.

The array is

A<44,512,3 uint8>

I need to drop the 3 and assign it to a new array B so that B would be

B<44,512 uint8>

I do not know how to proceed. Could someone please help me ?

Upvotes: 1

Views: 1275

Answers (1)

Jonas
Jonas

Reputation: 74940

Which 2D slice of your 3D array do you need? If you want slice #2, you do:

B = A(:,:,2);

Upvotes: 1

Related Questions