help-octave
[Top][All Lists]
Advanced

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

Re: Constructing arrays


From: Andy Buckle
Subject: Re: Constructing arrays
Date: Mon, 26 Jul 2010 15:27:02 +0100

On Mon, Jul 26, 2010 at 3:11 PM, dirac <address@hidden> wrote:
>
> That worked brilliantly, can I ask how it works? Also what does the double
> equals sign mean (==) in matlab? Again probably a really simple explanation
> if I knew other languages!
>
> What do you mean by the PS you left? I think I accidently replied to the
> email notification I recieved...

Like in c
= is the assignment operator
== is the equality operator

a==0 gives a matrix with ones at locations where a is 0, and zeros
everywhere else. find() takes a matrix like this and yeilds a matrix
of the indices of all nonzero values. If you index the original array
with that, you can set all these locations to something. In this case
the empty matrix, which removes them.

I recommend that you play around with simple examples.

The PS: If you include previous text in your email please do this

>> A
> B
C

please do not do this

C
> B
>> A

(Depending on email client...) the first is easier to follow.


reply via email to

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