|
From: | Nicholas Jankowski |
Subject: | Re: Placing Functions Inline to Script |
Date: | Thu, 8 Jun 2017 12:31:24 -0400 |
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)
[Prev in Thread] | Current Thread | [Next in Thread] |