[英]Matlab Isolating 2D Array from 3D Matrix
I have a 3D matrix called M of size <100x100x100>, so basically coordinates. 我有一个名为M的3D矩阵<100x100x100>,所以基本上是坐标。
I am trying to get the array of at specific values of y. 我试图得到特定y值的数组。 However using M(:,1,:) I get a <100x1x100> matrix whereas finding I can use M(:,:,1) and get a <100x100> matrix. 然而,使用M(:,1,:)我得到<100x1x100>矩阵,而发现我可以使用M(:,:,1)并获得<100x100>矩阵。
Is there an easy way to turn the <100x1x100> into a <100x100> by either isolating it a different way or using a short translation? 是否有一种简单的方法可以将<100x1x100>转换为<100x100>,方法是以不同的方式隔离或使用简短的翻译?
Thanks, 谢谢,
Does squeeze
do what you want? squeeze
做你想要的吗?
a = ones(100, 1, 100);
b = squeeze(a);
size(b) % 100x100
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.