[Top][All Lists]

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

Command line parameters

From: Daryl Lee
Subject: Command line parameters
Date: Tue, 26 Apr 2011 11:20:58 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9

I'm fairly new to Octave. I've figured out how to pass command-line arguments to a script, but only if that script is an executable script or called from the system command line, a la "$ octave myscript.m arg1 arg2". Is there a way to do so from the Octave console? When I am at the Octave prompt and type "myscript arg1 arg2" I get "error: invalid use of script in index expression." I'm using Octave 3.2.4 on a Windows 7 64-bit laptop.

Here is the script that I have so far:
% Display command line

printf('%s; %d arguments\n', program_name(), nargin);
arg_list = argv();
for i = 1:nargin
   printf('%d argument = %s\n', i, arg_list{i});

Daryl Lee

reply via email to

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