[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fwd: Run script octave from command line with more that one function
From: |
Juan Pablo Carbajal |
Subject: |
Fwd: Run script octave from command line with more that one function |
Date: |
Mon, 18 Jun 2018 10:00:42 +0200 |
Please do not send private message, keep the conversation in the maling list.
Some answers below.
The Ocvate version is 4.0.0
See if you can get 4.4 (for example using flatpak)
#!/usr/bin/octave -qf
%%%%%% definition fun1 %%%%%
function fun1(a,b,c)
....
w = fun2(1,4,6);
k = fun3(w,0,q)
....
return
%%%%%% definition fun2 %%%%%%%%%%%%%%%
function z = fun2(d,e,f)
.....
return
%%%%%% definition fun3 %%%%%%%%%%%%%%%
function h = fun3(q,e,l)
.....
return
Probably the answer is _no_ because a script that run from command
line cannot have a _function_ inside.
The problem here is that the first executable line in the script is
the keyword "function". Scripts shold start with anything but the
keyword functions.
For example check this script
#!/usr/local/bin/octave -qf
## Script to repeat the word "Hi!"
1;
function s = rep_hi(n)
s = repmat("Hi!", n, 1);
endfunction
n = str2num (argv(){1});
printf ("Print 'Hi!' %d times.\n", n);
disp (rep_hi (n));
When I call it I get this
$ ./s_repeat_hi 3
Print 'Hi!' 3 times.
Hi!
Hi!
Hi!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Fwd: Run script octave from command line with more that one function,
Juan Pablo Carbajal <=