[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getopt
From: |
Juergen Rose |
Subject: |
Re: getopt |
Date: |
Sun, 11 Oct 2009 09:22:34 +0200 |
Am Samstag, den 10.10.2009, 13:50 -0400 schrieb John W. Eaton:
> On 11-Oct-2009, Juergen Rose wrote:
>
> | thank you for the answer. I did not expect that something like getopt is
> | not yet implemented in octave. All other languages I use (C, bash, perl,
> | R) have such a possibility. For me as a octave newcomer it is not very
> | easy to do it.
>
> Procssing getopt-style options is not a common idiom in Octave.
>
> It's relatively inconvenient to do
>
> result = foo ("-x", x_var, "-y" "-z");
>
> and if you use the command-style syntax:
>
> foo -x x_var -y -z
>
> instead, you can't assign the result fo the function to a variable and
> all the arguments are passed to the function as character strings,
> which is not the usuall thing to do for a numerically-oriented
> language like Octave.
>
> So I would ask why you want to do this. If you tell us what you are
> trying to do, someone might be able to suggest a convenient way to do
> it.
>
> jwe
I want to write a octave script (superimpose.m) which should superimpose
to sets of vectors, these vectors should be contained in two files. My
script starts now:
#! /usr/bin/octave -qf
arg_list = argv();
fileA = arg_list{1};
fileB = arg_list{2};
dataA=load("-ascii",fileA);
dataB=load("-ascii",fileB);
Until now I load only csv files. Now I want to extend the script that it
can't read directly PDB (Brookhaven Protein) files. I.e., I would like
to call my script
$ superimpose.m file1.csv file2.csv
to superimpose to csv files, and
$ superimpose.m -p file1.pdb file2.pdb
to superimpose to pdb files and perhaps
$ superimpose -h to print a help message.
inside of the script I want to parse argslist or argv() with a getopt
function similar to those used in bash, perl or C.
Regards Juergen.
- getopt, Juergen Rose, 2009/10/10
- RE: getopt, dastew, 2009/10/10
- RE: getopt, Juergen Rose, 2009/10/10
- Re: getopt, Ben Abbott, 2009/10/10
- Re: getopt, Juergen Rose, 2009/10/10
- Re: getopt, Ben Abbott, 2009/10/10
- Re: getopt, John W. Eaton, 2009/10/10
- Re: getopt, Juergen Rose, 2009/10/10
- Re: getopt, John W. Eaton, 2009/10/10
- Re: getopt, Judd Storrs, 2009/10/10
- Re: getopt,
Juergen Rose <=
- Re: getopt, Judd Storrs, 2009/10/10
- Re: getopt, Juergen Rose, 2009/10/10
- Re: getopt, Jaroslav Hajek, 2009/10/10
- Re: getopt, Juergen Rose, 2009/10/10
- Re: getopt, Carlo de Falco, 2009/10/11
- Re: getopt, Martin Helm, 2009/10/10