subscript dimension error warning

1 回表示 (過去 30 日間)
Osita Onyejekwe
Osita Onyejekwe 2016 年 7 月 29 日
回答済み: Walter Roberson 2016 年 7 月 30 日
I keep getting this error,
Subscripted assignment dimension mismatch.
Error in FCN_ECG_PLOTS (line 77)
bwmap(i, iNoise)= bw(idx); % % with the index we find what the actual bandwidth value
is.
The portion of the code goes like this , (the function is where the error occurs)
for i= 1:N
mx= max(SNR(i,:, iNoise)) ;
idx=find(SNR(i,:, iNoise)==mx);
*bwmap(i, iNoise)= bw(idx);*** this is where it dies
.
.
.
end
note that when i use bw = 0.1:0.1:0.5 it works PERFECTLY but when I use bw= 0.001:0.001:0.005; i get that error, this makes NO sense..why?!! i need to use the second bw not the first one (different data)

採用された回答

Walter Roberson
Walter Roberson 2016 年 7 月 30 日
find() will return multiple locations if there are multiple matches. That is, you are encountering a situation in which two locations contain the identical maximum value. In fact, the only reason to do those operations on two different lines is for the case where you expect there to be multiple locations with the same maximum and you either want to know them all or else you want control over which of the locations with identical values is selected.
If you just want to know one of the locations and do not care which then combine the two lines:
[mx, idx] = max(SNR(i,:, iNoise));
bwmap(i, iNoise)= bw(idx);

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by