help-octave
[Top][All Lists]
Advanced

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

Re: function help


From: Ben Abbott
Subject: Re: function help
Date: Thu, 23 Feb 2012 18:12:29 -0500

On Feb 23, 2012, at 5:56 PM, Tom Bohdan wrote:

> --- On Fri, 24/2/12, Ben Abbott <address@hidden> wrote:
> 
>> On Feb 23, 2012, at 4:26 AM, Tom Bohdan <address@hidden> wrote:
>> 
>>> I have had no success with finding why the following doesn't work. I have 
>>> tried many examples in Octave's Help and they don't work either.
>>> 
>>> Why is it that if you type each line into the command line then the 
>>> following works:
>>> 
>>> function total=addr(x,y)
>>> total=x+y;
>>> endfunction
>>> 
>>> add(5,4)
>>> 
>>> >ans=9
>>> 
>>> but if i put the above lines into a m-file then the interpreter spits out x 
>>> undefined etc.
>>> 
>>> This happens for all the functions i have found in the LSODE examples etc. 
>>> If you type them one by one at the command line it works but not in a 
>>> script file. What am i missing ???
>>> 
>>> regards
>>> Tom
>> 
>> Did you intend "add()" or "addr()" ?
>> 
>> Ben
> 
> thanks for your prompt reply. 
> Another person suggested that it was because there may be a function called 
> add() that may be messing it up but i retried the following and got the same 
> problems:
> 
> function total=exxample(x,y)
> total=x+y;
> endfunction
> exxample(9,8)
> 
> At home i use Ubuntu 10.10 LTS which has octave 2.3.3. I typically use QT 
> octave but i tried it on the command line of Octave itself too.
> 
> At work i use Windows Xp and QT Octave and Octave 2.3.4. Again similar issues 
> BUT i did have some success.
> 
> if i hit Run within the editor of QT octave on the Windows version only the 
> script worked !
> 
> If i run it by the Command line in the dos window it failed exactly like the 
> Linux versions with undefined x in row2, col7 or something like that.
> 
> If its typed line -by-line into the Command line it works too. It must be a 
> bug?

When you write "run it by the Command line", but exactly did you do? How is it 
different than typing in at the Command line ?

Ben




reply via email to

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