subscript dimension error warning
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Osita Onyejekwe
le 29 Juil 2016
Réponse apportée : Walter Roberson
le 30 Juil 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 commentaires
Réponse acceptée
Walter Roberson
le 30 Juil 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Modulation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!