Discussion:
Rajendra Marathe
2018-12-07 06:07:51 UTC
Permalink
I have a column matrix A(5000,1)
It has elements with values from 1 to 10
I wish to substitute the elements with value of 10 With value of 0
Please let me know how I can implement this on octave
R V Marathe
Richardson, Anthony
2018-12-07 14:24:10 UTC
Permalink
A(find(A == 10)) = 0;

Or, more directly using logical indexing,

A(A == 10) = 0;

Tony Richardson

From: Help-octave <help-octave-bounces+richardson=***@gnu.org> On Behalf Of Rajendra Marathe
Sent: Friday, December 7, 2018 12:08 AM
To: help-***@gnu.org
Subject:

I have a column matrix A(5000,1)
It has elements with values from 1 to 10
I wish to substitute the elements with value of 10 With value of 0
Please let me know how I can implement this on octave
R V Marathe
Nicholas Jankowski
2018-12-07 14:47:13 UTC
Permalink
Post by Richardson, Anthony
A(find(A == 10)) = 0;
Or, more directly using logical indexing,
A(A == 10) = 0;
different indexing schemes can be very powerful ways of manipulating and
processing your data. I recommend you read:

https://octave.org/doc/v4.2.2/Index-Expressions.html
and
https://octave.org/doc/v4.2.2/Advanced-Indexing.html#Advanced-Indexing
Rajendra Marathe
2018-12-07 15:02:09 UTC
Permalink
Thanks, I'll check it out.
Post by Nicholas Jankowski
Post by Richardson, Anthony
A(find(A == 10)) = 0;
Or, more directly using logical indexing,
A(A == 10) = 0;
different indexing schemes can be very powerful ways of manipulating and
https://octave.org/doc/v4.2.2/Index-Expressions.html
and
https://octave.org/doc/v4.2.2/Advanced-Indexing.html#Advanced-Indexing
Loading...