octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #60291] Function parameters not supported when


From: Rik
Subject: [Octave-bug-tracker] [bug #60291] Function parameters not supported when calling from the shell
Date: Thu, 1 Apr 2021 17:15:05 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36

Update of bug #60291 (project octave):

                Severity:              3 - Normal => 1 - Wish               
                Priority:              5 - Normal => 3 - Low                

    _______________________________________________________

Follow-up Comment #3:

This sounds confusing, and I don't think I'd want to do it as a general part
of Octave.  But if you really want to for your own code, couldn't you just use
default input arguments?  When called from the command line there would be no
function input so the default would be used.  When called from Octave with an
argument the argument would be overriden.

For example, the function mysin.m which calculates the sine of a value.


#!/usr/local/bin/octave -qf
function retval = mysin (x = str2double (argv(){end}))
  retval = sin (x)
endfunction


This can be called from the command line with


mysin.m 5


or from Octave with


mysin (5)


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60291>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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