Minimum value ineach column
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
EldaEbrithil
am 14 Aug. 2020
Kommentiert: EldaEbrithil
am 14 Aug. 2020
Hi all
i want to extract the minimum positive value in each column, i have used this code
for j=1:length(columnA)
a(j)=min(A(A(:,j)>0));
end
but i am not able to solve the problem. A is a matrix
Thank for the help
0 Kommentare
Akzeptierte Antwort
Matt J
am 14 Aug. 2020
Bearbeitet: Matt J
am 14 Aug. 2020
We don't know what columnA is in the code that you've shown. It would have to be a vector with the same number of columns as A for the code to work.
Regardless, the complete operation can easily be done without looping:
B=A: B(A<=0)=+inf;
a=min(B,[],1);
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!