help-octave
[Top][All Lists]
Advanced

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

Re: Understanding a dot


From: Kim Hansen
Subject: Re: Understanding a dot
Date: Mon, 24 Mar 2008 10:47:07 +0100

On Sun, Mar 9, 2008 at 1:20 PM, Søren Hauberg <address@hidden> wrote:
> Hi all,
>   By accident I've just typed a dot instead of a semi-colon in a
>  for-loop. This didn't produce an error, as I would have expected. Here's
>  an example:
>
>   octave:15> tmp = rand(1,3)
>   octave:16> for i = 1.length(tmp), i, endfor
>   ans =  3
>   i =  1
>
>  I don't understand this code. It seems to behave just like
>
>   length(tmp), for i = 1, i, endfor
>
>  but I don't understand the syntax. Can anybody explain this syntax to
>  me?

I guess 1. is read by the same code that would read 1.0, the code
could be reformated as:
  for i = 1.
      length(tmp)
      i
  endfor

How does Matlab handle decimal points without any decimals after them?

-- 
Kim Hansen
Vadgårdsvej 3, 2.tv
2860 Søborg
Fastnet: 3956 2437 -- Mobil: 3091 2437



reply via email to

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