フィルターのクリア

N-dimensional arrays are not supported.

6 ビュー (過去 30 日間)
hamed
hamed 2016 年 8 月 5 日
コメント済み: Star Strider 2016 年 8 月 6 日
Hello All
I have a 3d matrix as below:
[l,r,h3]=size(H)
When I want to write eye(), as follows, I get an error.
Aeq=[H1 -eye(l)]
The error is:
N-dimensional arrays are not supported.
How can I solve it?
thanks
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 8 月 5 日
What is H1?

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

採用された回答

Star Strider
Star Strider 2016 年 8 月 6 日
I have no idea what you’re doing or what result you want, or what ‘H’ or ‘H1’ are.
This runs without error:
H = randi(9,2,2,4); % Create ‘H’
[l,r,h3]=size(H);
H1 = H; % Assume ‘H1’ = ‘H’
Aeq=[H1 -repmat(eye(l), 1, 1, h3)] % Desired Result?
Perhaps some variation on this will work for you if this does not.
  2 件のコメント
hamed
hamed 2016 年 8 月 6 日
Thanks a lot. It did work!
Star Strider
Star Strider 2016 年 8 月 6 日
My pleasure!

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

その他の回答 (1 件)

Konark Kelaiya
Konark Kelaiya 2016 年 8 月 6 日
Your H1 or H whatever the variable is 3D matrix however when you get the size of H with [I,r,h3] it will return matrix size values e.g if H is of 2x3x2 matrix then using size(H) returns value as I = 2,r =3 and h3 = 2.
Now when you use eye(I) , it will create identity matrix of 2x2 and not 3 dimensional , hence it wont work
you need to use
[H1 - eye([I r h3])]
or [H1 - eye(size(H))]
  1 件のコメント
hamed
hamed 2016 年 8 月 6 日
Hello
Thanks for your help.
I tried that code, but it didn't word! The same error appeared again.

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by