[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
change element min in matrix
From: |
shivax |
Subject: |
change element min in matrix |
Date: |
Thu, 14 Nov 2019 10:46:43 -0600 (CST) |
look this example:
g=[4 5 6;1 2 3;9 4 5]
i want to find minimun for each rows and change it with zero
min(g,[],2)
ans F: 4 1 4
now i change min value in matrix:
g=[0 5 6;0 2 3;9 0 5]
to do it i code :
for i=1:length(F)
idx=(find(g(:,i)==F(i))
g(idx,i)=0;
endfor
but it's possible to avoid loop? thank you
--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
- change element min in matrix,
shivax <=