help-octave
[Top][All Lists]
Advanced

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

Placing Functions Inline to Script


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

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




reply via email to

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