Find zeros in a part of a matrix
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Konstantinos Tsitsilonis
il 28 Nov 2017
Commentato: Konstantinos Tsitsilonis
il 28 Nov 2017
Hi all,
I have a matrix such that:
Tarr =
1.0e+05 *
0.0006 0.0000 0.0000 0.0000 0
0.0002 0 0 0 0
0.0001 0 0 0 0.0001
0.0004 0 0 0 0
0 1.3018 1.4506 0.2323 0.0540
0.0005 0.0000 0.0000 0 0
0.0002 0 0 0 0
0.0000 0 0 0 0
0.0004 0 0 0 0
0 -2.9018 -3.0506 0.2323 0.0540
0.0005 0 0 0 0
0.0002 0 0 0 0
0.0000 0 0 0 0
0.0004 0 0 0 0
0 0 0 0.2323 0.0540
I would like to find the indices of the zero elements in the following subsection of the matrix
Tarr(5:5:end,2:end)
An then replace those with some numbers I desire. I know this must be fairly easy, however I cant seem to be able to find a straightforward way.
KR,
KMT.
0 Commenti
Risposta accettata
Jos (10584)
il 28 Nov 2017
temp = Tarr(5:5:end,2:end) ; % get the relevant portion
temp(temp==0) == 12345 ; % your value
Tarr(5:5:end,2:end) = temp ; % put the edited portion back in
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!