Data comparison and selection the smallest
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
stelios loizidis
am 11 Jun. 2020
Kommentiert: stelios loizidis
am 11 Jun. 2020
Hello. I have a matrix A which has size of 24X5. I want each row in matrix A to be selected the smallest and stored in matrix B. Below is the code I wrote but it does not work (error: Index in position 2 exceeds array bounds (must not exceed 5)).
for i=1:24
for j=1:5
if A(i,j)<A(i,j+1)
B(i)=A(i)
else
B(i)=A(j+1)
end
end
end
Your help is very important!!!!
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices 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!