d.mc2
d.mc2

Reputation: 1129

Matlab Isolating 2D Array from 3D Matrix

I have a 3D matrix called M of size <100x100x100>, so basically coordinates.

I am trying to get the array of at specific values of y. However using M(:,1,:) I get a <100x1x100> matrix whereas finding I can use M(:,:,1) and get a <100x100> matrix.

Is there an easy way to turn the <100x1x100> into a <100x100> by either isolating it a different way or using a short translation?

Thanks,

Upvotes: 3

Views: 4571

Answers (1)

carl
carl

Reputation: 50554

Does squeeze do what you want?

a = ones(100, 1, 100);
b = squeeze(a);
size(b) % 100x100

Upvotes: 5

Related Questions