help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find() and setting matrix elements to 1


From: Nir Krakauer
Subject: Re: find() and setting matrix elements to 1
Date: Tue, 8 Oct 2013 12:11:03 -0400

ind = find(C <= 0.5);
C(ind) = 1;

If you need the row and column indices, use
[i, j] = ind2sub([5, 6], ind);

Otherwise one line is enough:
C(C <= 0.5) = 1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]