简体   繁体   中英

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,

Does squeeze do what you want?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM