[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help using dimensions on min()
From: |
Juan Pablo Carbajal |
Subject: |
Re: help using dimensions on min() |
Date: |
Fri, 28 Jun 2013 14:28:52 +0200 |
On Fri, Jun 28, 2013 at 2:19 PM, Chris Daamen <address@hidden> wrote:
> Yes that solved it! Incredible I missed that one... I feel very dumb now,
> this has taken many hours already. Thanks a lot for your quick answer!
>
> Is there actually some established strategy on how to avoid such name
> collisions? As probably noone knows all function names by heart. I guess I
> could prefix all variables with something, but maybe there has been developed
> some standard strategy for this.
>
> Op 28 jun. 2013, om 14:06 heeft Juan Pablo Carbajal het volgende geschreven:
>
>> On Fri, Jun 28, 2013 at 2:00 PM, Chris Daamen <address@hidden> wrote:
>>> [min, minSigma] = min(testMatrix,[],1)
>>> [min, minC] = min(testMatrix,[],2)
>>
>> The problem is that you are overwriting the name of the function min,
>> and make it a variable (see your commands above). If you execute
>> [m1, minSigma] = min(testMatrix,[],1)
>> [m2, minC] = min(testMatrix,[],2)
>>
>> Everything works fine. Remember not to overwrite your function names
>> by variables.
>
>
Hi,
I am glad to be useful.
Please do not top post http://en.wikipedia.org/wiki/Top_posting#Top-posting
I write octave code since about 10 years and I have never problems
with too many collisions of variable and function names. If you are
unsure before you choose a name for a variable just write the name on
the interpreter and press [TAB] two times, then you will get the names
of functions in the scope. If it happens that later on you load a
function or a package that creates a collision you can
search'n'replace the offending name.
Today someone mentioned tree generation from code, this is a clear
application where it can be useful. To detect if code will overwrite a
function name in the scope (and provide code suggestions a the ML
editor does).