[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: varargin with executable octave scripts
From: |
mavram |
Subject: |
Re: varargin with executable octave scripts |
Date: |
Tue, 12 Oct 2004 19:12:38 +0200 |
User-agent: |
Mutt/1.5.5.1+cvs20040105i |
On Tue, Oct 12, 2004 at 05:51:54PM +0200, David Bateman wrote:
> Try it as with length(argv) or __nargin__. That is
>
> #! /usr/bin/octave -qf
> printf ("%s", program_name);
> for i = 1:length(argv)
> printf (" %s", argv{i});
> endfor
> printf ("\n");
> size(argv)
>
> or
>
> #! /usr/bin/octave -qf
> printf ("%s", program_name);
> for i = 1:__nargin__
> printf (" %s", argv{i});
> endfor
> printf ("\n");
> size(argv)
>
> Seems the docuemntation is wrong.
>
> wrong..
>
> D.
>
>
> According to address@hidden <address@hidden> (on 10/12/04):
> > Sorry for the dumb question:
> > Example from info, very slightly modified, named autonome:
> >
> > #! /usr/bin/octave -qf
> > printf ("%s", program_name);
> > for i = 1:nargin
> > printf (" %s", argv{i});
> > endfor
> > printf ("\n");
> > size(argv)
> > nargin
> > who
> >
> > autonome addhour cleancat gracespectra
> > autonome
> > ans =
> >
> > 3 1
> >
> > ans = 0
> >
> > *** dynamically linked functions:
> >
> > dispatch
> >
> > *** local user variables:
> >
> > i
> >
> > Not the output I expected. Either I made some blunder(s) or the info is
> > badly
> > out of tune with my version of octave (2.1.57).
> > Any suggestions ? I would like this script to input data from a file, to
> > be specified on the command-line.
> > System: Debian Linux testing/unstable, kernel 2.4.
> > Thanks for any advice/pointer,
> > Avraham
> >
> >
> >
> > -------------------------------------------------------------
> > Octave is freely available under the terms of the GNU GPL.
> >
> > Octave's home on the web: http://www.octave.org
> > How to fund new projects: http://www.octave.org/funding.html
> > Subscription information: http://www.octave.org/archive.html
> > -------------------------------------------------------------
>
> --
> David Bateman address@hidden
> Motorola CRM +33 1 69 35 48 04 (Ph)
> Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
> 91193 Gif-Sur-Yvette FRANCE
>
> The information contained in this communication has been classified as:
>
> [x] General Business Information
> [ ] Motorola Internal Use Only
> [ ] Motorola Confidential Proprietary
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
>
Thanks David. Both versions work. I am able to open a file mentioned on
the command line by refering to it as vararg{1}, vararg{2} etc.
Now, can you give also a pointer to your specific source of information,
or it is not that simple ?
Cheers, Avraham
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------