Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

a problem with generating numbers

0 views
Skip to first unread message

Bita Mirshafiee

unread,
Dec 30, 2011, 7:52:58 AM12/30/11
to
Hi all,

I have a question about the below code :

1 : . 5 : 10

Would you please explain what does it do?
Actually the '.5' between 1 and 10 confused me, I run it in MATLAB It
gave me a row vector with 19 columns, I don't now what's its
functionality.

Thanks in Advance.
Sophia.

John D'Errico

unread,
Dec 30, 2011, 8:32:08 AM12/30/11
to
Bita Mirshafiee <b.mirsh...@gmail.com> wrote in message <1c36f246-3fe7-4c87...@q9g2000yqe.googlegroups.com>...
> Hi all,
>
> I have a question about the below code :
>
> 1 : . 5 : 10
>
> Would you please explain what does it do?
> Actually the '.5' between 1 and 10 confused me, I run it in MATLAB It
> gave me a row vector with 19 columns, I don't now what's its
> functionality.

Gosh, I thought this was quite clearly covered in the tutorials.
Oh. You never read them, or any of the help documents? Is
that why you are asking the most basic question possible,
one that will be covered almost immediately?

Really, you need to read the help. Otherwise, you will be
asking questions for every single function and command
in matlab.

Next, learn to experiment. Try things in matlab, in the
command window. See what they do, and see how that
relates to what you tried.

If you honestly did this and cannot imagine what that
expression does in matlab, then you really desperately do
need to read the tutorials.

JOhn

dpb

unread,
Dec 30, 2011, 11:06:17 AM12/30/11
to
On 12/30/2011 7:32 AM, John D'Errico wrote:
> Bita Mirshafiee <b.mirsh...@gmail.com> wrote in message
> <1c36f246-3fe7-4c87...@q9g2000yqe.googlegroups.com>...
>> Hi all,
>>
>> I have a question about the below code :
>>
>> 1 : . 5 : 10
>>
>> Would you please explain what does it do?
>> Actually the '.5' between 1 and 10 confused me, I run it in MATLAB It
>> gave me a row vector with 19 columns, I don't now what's its
>> functionality.
>
> Gosh, I thought this was quite clearly covered in the tutorials.
> Oh. You never read them, or any of the help documents? Is
> that why you are asking the most basic question possible,
> one that will be covered almost immediately?
>
> Really, you need to read the help. Otherwise, you will be
> asking questions for every single function and command
> in matlab.
...

Agreed, but specifically for this introductory problem, try

doc colon

--

Greg Heath

unread,
Dec 30, 2011, 2:17:02 PM12/30/11
to
19 columns? .. Hmm... are they randomly spaced?

Greg
0 new messages