subscript dimension error warning
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Osita Onyejekwe
il 29 Lug 2016
Risposto: Walter Roberson
il 30 Lug 2016
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)
0 Commenti
Risposta accettata
Walter Roberson
il 30 Lug 2016
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Modulation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!