Error using cat: Dimensions of arrays being concatenated are not consistent.

2 ビュー (過去 30 日間)
Jonas Damsbo
Jonas Damsbo 2018 年 11 月 27 日
コメント済み: Jonas Damsbo 2018 年 11 月 27 日
I want to combine 4 matrices with dimensions:
z = 360x181x124
z1 = 360x181x124
z2 = 360x181x112
z3 = 360x181x124
I use the cat function:
z_T = cat(1,z,z1,z2,z3);
But i get the error "Dimensions of arrays being concatenated are not consistent."
I know why I get it but I dont know how I can solve it. Please help!

採用された回答

Image Analyst
Image Analyst 2018 年 11 月 27 日
Those are 3-D images so you need to concatenate along the 4th dimension:
z_T = cat(4, z, z1, z2, z3);
unless you just want them in one big long 1-D vector, in which case you'd do this:
z_T = cat(1, z(:), z1(:), z2(:), z3(:));
  3 件のコメント
Image Analyst
Image Analyst 2018 年 11 月 27 日
OK, well close. Is it close enough for you to "Accept this answer"?
Jonas Damsbo
Jonas Damsbo 2018 年 11 月 27 日
Yes ;)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by