Error ' Assignment has more non-singleton rhs dimensions than non-singleton..'

1 回表示 (過去 30 日間)
Ede gerlderlands
Ede gerlderlands 2013 年 6 月 13 日
I want to find the location of maximum 'EC' in the first direction. Here is the code I used to find so.
for ii=1:size(EC,2);
ss(1,ii,:)=max(EC(:,ii,:),[],1);
loc(1,ii,:) = find(EC(:,ii,:) == ss(1,ii,:));
end
but an error ' Assignment has more non-singleton rhs dimensions than non-singleton subscripts' keeps coming. Can anyone tell me what to do with it?
  5 件のコメント
Walter Roberson
Walter Roberson 2013 年 6 月 13 日
If you are trying to find the maximum of each column along with the associated indices, use the two-output version of max()
[ss(1,ii,:), loc(1,ii,:)] = max(EC(:,ii,:),[],1);
However you need to decide which index you want returned if there are multiple copies of the maximum in any given column.
Ede gerlderlands
Ede gerlderlands 2013 年 6 月 13 日
Thank you very much...

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by