help-octave
[Top][All Lists]
Advanced

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

argv


From: John W. Eaton
Subject: argv
Date: Fri, 16 Nov 2001 11:01:26 -0600

On 16-Nov-2001, Paolo Ariano <address@hidden> wrote:

| my function function well now (thanks to Mirek) interactively but noe
| i'd like to make it self-standing, i can't pass more than one argument:
| 
| 
| 
| function graph(filename,grafico);
|   gset term postscript eps enhanced color solid "helvetica" 14;
|   gset([ 'title "', filename, '"' ]);
|   gset([ 'output "', grafico, '"' ])
|   for t=1:4
|     [hmatt,matt] = histot(filename,t);
|     subplot (2,2,t);
|     bar (hmatt(1,:),hmatt(2,:));
|   endfor
|   oneplot
| endfunction
| 
| for i = 1:nargin
| graph(argv(i,:))
| endfor
| 
| 
| 
| but when i type: graph data_file_input grafic_file_output
| 
| error: `grafico' undefined near line 67 column 22
| error: evaluating expression near line 67, column 22
| error: evaluating argument list element number 1
| error: evaluating index expression near line 67, column 3
| error: called from `graph'
| 
| why i can't sende my second parameter grafic_file_output to the function
| ? i've also tried with some printf but grafico is not defined only the
| first filename is well defined

You only called the graph function with one argument.  Perhaps you
meant

  if (nargin == 2)
    graph (argv(1,:), argv(2,:));
  else
    error ("...");
  endif

or

  for i = 1:2:nargin
    graph (argv(i,:), argv(i+1,:));
  endfor

or something else?

jwe



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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