필터 지우기
필터 지우기

subscript dimension error warning

조회 수: 2 (최근 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 CenterFile Exchange에서 Modulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by