フィルターのクリア

Assignment has more non-singleton rhs dimensions than non-singleton subscripts

1 回表示 (過去 30 日間)
hamed
hamed 2016 年 7 月 18 日
コメント済み: Guillaume 2016 年 7 月 19 日
I have the codes as follows:
function [H1,c,s,path,d,m]=topology1(topo)
if (strcmp(topo,'access'))
H=zeros(24,18,3);
H1=zeros(size(H,1),size(H,2),3);
H1(:,:,1)=H;
When I want to run the function "topology" I encounter to this error:
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Please help me about this issue.

採用された回答

Walter Roberson
Walter Roberson 2016 年 7 月 18 日
You are trying to store all of a 3 dimensional object, H, into a 2 dimensional space, H1(:,:,1)
Perhaps you wanted
H1(:,:1) = H(:,:,1);
  2 件のコメント
hamed
hamed 2016 年 7 月 19 日
Thanks a lot. It did work!
Guillaume
Guillaume 2016 年 7 月 19 日
While "it did work". The code is exactly equivalent to:
H = zeros(24, 18, 3);
H1 = H;
which would be much clearer.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by