[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using eye as in [A eye (2)]
From: |
Ben Abbott |
Subject: |
Re: Using eye as in [A eye (2)] |
Date: |
Sat, 04 Feb 2012 19:38:12 -0500 |
On Feb 4, 2012, at 7:05 PM, John B. Thoo wrote:
>
> On Feb 4, 2012, at 3:57 PM, Ben Abbott wrote:
>
>> On Feb 4, 2012, at 6:51 PM, John B. Thoo wrote:
>>
>>> Hi. I have a newbie question.
>>>
>>> If I define
>>>
>>> A = [1,3;1,2]
>>>
>>> and
>>>
>>> D = eye (2)
>>>
>>> then I get as expected
>>>
>>> octave-3.2.3:20> [A D]
>>> ans =
>>>
>>> 1 3 1 0
>>> 1 2 0 1
>>>
>>>
>>> But [A eye (2)] does not give the same thing:
>>>
>>> octave-3.2.3:21> [A eye (2)]
>>> error: number of rows must match (1 != 2) near line 21, column 5
>>> octave-3.2.3:21>
>>>
>>> What am I not understanding? TIA.
>>>
>>> ---John.
>>
>> The syntax [A eye (2)] is equivalent to [A, eye, 2].
>>
>> Try [A, eye(2)] instead.
>
> Ah! Thank you Ben. That was dumb on my part. Maybe I should stop putting a
> space between a function name and the opening parenthesis.
>
> ---John.
I like the space between functions and (). It helps document what are intended
to be functions and what are variables. You could do something like [A, (eye
(2))].
Ben