Attempted to access sorted_evalue(1); index out of bounds because numel(sorted_evalue)=0. smallest_ev1p = 0.01 * sorted_evalue(1); % to obtain the effective eigen values
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
prema13
am 23 Feb. 2016
Kommentiert: Jan
am 24 Feb. 2016
[sorted_evalue, index] = sort( evalue );
sorted_evalue = flipud( sorted_evalue );
index = flipud( index );
evector( :, 1:nof ) = evector ( :, index );
smallest_ev1alue = (1/100) * sorted_evalue(0);
for i = 1:nof
if (sorted_evalue(i) < smallest_evalue)
break;
end
end
index = i+1;
evector = evector( :, 1:index );
1 Kommentar
Jan
am 24 Feb. 2016
Please do not post multiple questions for one problem. See http://www.mathworks.com/matlabcentral/answers/269721-attempted-to-access-sorted_evalue-0-index-must-be-a-positive-integer-or-logical-how-to-rem
Akzeptierte Antwort
Walter Roberson
am 23 Feb. 2016
Your code fails if evalue is empty at the start of your code. You assume that it is not empty without testing it.
Note: you may wish to consider using sort with 'descending' flag instead of flipud() on the results. You will also need to fix the problem with evalue being empty, but it will make the rest of your code more simple.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!