help-octave
[Top][All Lists]
Advanced

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

Re: Placing Functions Inline to Script


From: Fritz Sonnichsen
Subject: Re: Placing Functions Inline to Script
Date: Thu, 8 Jun 2017 12:31:00 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

OK guys. That worked---peculiar syntax (;->

Thanks
Fritz

On 6/8/2017 11:26 AM, Doug Stewart wrote:


On Thu, Jun 8, 2017 at 10:03 AM, Fritz Sonnichsen <address@hidden> wrote:
I am a new octave user (matlab refugee) and trying to get through a few very basic problems to get going. I am trying to define functions within a script as shown in the code below. The script fails claiming it cannot find the function. The only workaround is to make the main script a function as well but this has some repercussions regarding preserving variables. Short of having separate files running around with my functions is there a way to help the script "see" the function definition?

Thanks
Fritz

%%%%%%%%%% script %%%%%%%%
maxpoint(3);

%%%%%%%% functions %%%%%%%
function maxpoint (p)
printf("point= %d",p);
endfunction

error: 'maxpoint' undefined near line 2 column 1


_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave



1;  % this makes it a script

%%%%%%%% functions %%%%%%%
function maxpoint (p)
printf("point= %d \n",p);
endfunction

%%%%%%%%%% script %%%%%%%%
maxpoint(3)

--
DASCertificate for 206392



reply via email to

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