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: Victor Semanic
Subject: Re: find() and setting matrix elements to 1
Date: Tue, 8 Oct 2013 09:16:57 -0700 (PDT)

Nir, 

Hmmm ... I could have sworn I tried the first option (i.e., C(find(C<=0.50)) = 1.0) but that did not work.

Of course, it works now :-)

Thank you for your quick response!  I appreciate it.


From: Nir Krakauer <address@hidden>
To: Victor Semanic <address@hidden>
Cc: "address@hidden" <address@hidden>
Sent: Tuesday, October 8, 2013 11:11 AM
Subject: Re: find() and setting matrix elements to 1

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]