フィルターのクリア

Insert 3D array into Another 3D Array

1 回表示 (過去 30 日間)
Jason Bond
Jason Bond 2017 年 6 月 7 日
コメント済み: Jason Bond 2017 年 6 月 7 日
Hi. I am trying to insert the contents of one 3D array into another. Both represent logical/binary volumes. So far I have,
Y = yMax-yMin;
X = xMax-xMin;
Z = zMax-zMin;
smallArray = ones(Y,X,Z);
bigArray = zeros(500,400,60);
bigArray(yMin:yMax,xMin:xMax,zMin:zMax) = smallArray;
The values of yMin, yMax, xMin, xMax, zMin, zMax, X, Y and Z are within the range of bigArray. For example, yMin = 10, yMax = 120, etc.
But I receive an error about "Subscripted assignment dimension mismatch".
Any guidance would be great, thanks!

採用された回答

Adam
Adam 2017 年 6 月 7 日
編集済み: Adam 2017 年 6 月 7 日
yMax - yMin
will always be 1 smaller than
yMin:yMax
because of the inclusive end points (assuming integers, of course, which we are here since they are indices).
e.g.
10 - 1 = 9
but
1:10
clearly gives an array of length 10.
You probably just need to put some +1's in your X, Y and Z
  1 件のコメント
Jason Bond
Jason Bond 2017 年 6 月 7 日
You're right. Thanks Adam!

サインインしてコメントする。

その他の回答 (1 件)

Jason Bond
Jason Bond 2017 年 6 月 7 日
You're right. Thanks Adam!

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by