parameter expansion

#!/bin/bash

tr -s' ' | cut -d' ' -f${*/%/,}

Example: ls -l | ./script 1 5
I would print the first and the 5th field of the input stream.

cut -d' ' -f1 -f5    -> cut -d' ' ${*/#/-f} don't run
cut -d' ' -f1, 5,     -> cut -d' ' ${*/%/,} don't run

I would expand -f1,5,7 etc.
How can I use parameters expansion in this script?

davide

[I'm sorry for my English...]


0
davide
2/6/2004 11:24:40 AM
comp.unix.shell 15269 articles. 0 followers. Post Follow

12 Replies
340 Views

Similar Articles

[PageSpeed] 15
On Fri, 06 Feb 2004 at 11:24 GMT, davide moro wrote:
> #!/bin/bash
> 
> tr -s' ' | cut -d' ' -f${*/%/,}
> 
> Example: ls -l | ./script 1 5
> I would print the first and the 5th field of the input stream.
> 
> cut -d' ' -f1 -f5    -> cut -d' ' ${*/#/-f} don't run
> cut -d' ' -f1, 5,     -> cut -d' ' ${*/%/,} don't run
> 
> I would expand -f1,5,7 etc.
> How can I use parameters expansion in this script?

#v+
#!/bin/bash

var="$@"
tr -s ' ' | cut -d ' ' -f "${var// /,}"
#v-

-- 
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License
0
Chris
2/6/2004 1:50:01 PM
2004-02-06, 11:24(+00), davide moro:
> #!/bin/bash
>
> tr -s' ' | cut -d' ' -f${*/%/,}
>
> Example: ls -l | ./script 1 5
> I would print the first and the 5th field of the input stream.
>
> cut -d' ' -f1 -f5    -> cut -d' ' ${*/#/-f} don't run
> cut -d' ' -f1, 5,     -> cut -d' ' ${*/%/,} don't run
>
> I would expand -f1,5,7 etc.
> How can I use parameters expansion in this script?

#! /bin/sh -
IFS=,
tr -s ' ' | cut -d' ' -f"$*"

(not with Bourne shell nor ash, but with every POSIX compliant
shell [including bash] and zsh)

With zsh: ${(j",")@}

-- 
St�phane                      ["Stephane.Chazelas" at "free.fr"]
0
Stephane
2/6/2004 2:41:45 PM
Very kindly from you, I really appreciate your help.
Thanks!

Regards,

davide


0
davide
2/6/2004 2:58:36 PM
2004-02-6, 13:50(+00), Chris F.A. Johnson:
[...]
> #!/bin/bash
>
> var="$@"
> tr -s ' ' | cut -d ' ' -f "${var// /,}"
[...]

Note, to follow-up on my post on the other thread, that the fact
that in var="$@", the positional parameters are joined with
spaces is undocumented (in zsh, they are joined with the first
character of IFS, and it's documented)

Worse:
bash-2.05b$ set a b c; IFS=,; a=$*; b="$*"
bash-2.05b$ echo "$a"
a,b,c
bash-2.05b$ echo "$b"
a,b,c
bash-2.05b$ IFS=; a=$*; b="$*"
bash-2.05b$ echo "$a"
a b c
bash-2.05b$ echo "$b"
abc

So, in assignment, in bash, the only thing you can rely on in an
assignment WRT to $* and $@ is:

var="$*"

The other ones are not documented and may have erratic effects
that could change from a version of bash to another as it's not
documented (ksh93 behavior is different, and POSIX is not
clear on that point too, and if it makes things clearer, chances
are that the specification will get adapted so that ksh93 is
conformant):

var=$*
var=$@
var="$@"

Well, you can assume that as long as you don't change IFS, they
will always result in the positional parameters joined with
space.

-- 
St�phane                      ["Stephane.Chazelas" at "free.fr"]
0
Stephane
2/6/2004 3:43:26 PM
On Fri, 6 Feb 2004 16:43:26 +0100, Stephane CHAZELAS
<this.address@is.invalid> wrote:

>2004-02-6, 13:50(+00), Chris F.A. Johnson:
>[...]
>> #!/bin/bash
>>
>> var="$@"
>> tr -s ' ' | cut -d ' ' -f "${var// /,}"
>[...]
>
>Note, to follow-up on my post on the other thread, that the fact
>that in var="$@", the positional parameters are joined with
>spaces is undocumented (in zsh, they are joined with the first
>character of IFS, and it's documented)
>

No, you're failing again due to ignorance of bash info pages.

Under special parameters heading:

<quote>
`@'
     Expands to the positional parameters, starting from one.  When the
     expansion occurs within double quotes, each parameter expands to a
     separate word.  That is, `"$@"' is equivalent to `"$1" "$2" ...'.
     When there are no positional parameters, `"$@"' and `$@' expand to
     nothing (i.e., they are removed).

</quote>

>Worse:
>bash-2.05b$ set a b c; IFS=,; a=$*; b="$*"
>bash-2.05b$ echo "$a"
>a,b,c
>bash-2.05b$ echo "$b"
>a,b,c
>bash-2.05b$ IFS=; a=$*; b="$*"
>bash-2.05b$ echo "$a"
>a b c
>bash-2.05b$ echo "$b"
>abc
>

You assign null to IFS, and the behaviour conforms, well you guessed, to
related info page anyway:

<quote>
`*'
     Expands to the positional parameters, starting from one.  When the
     expansion occurs within double quotes, it expands to a single word
     with the value of each parameter separated by the first character
     of the `IFS' special variable.  That is, `"$*"' is equivalent to
     `"$1C$2C..."', where C is the first character of the value of the
     `IFS' variable.  If `IFS' is unset, the parameters are separated
     by spaces.  If `IFS' is null, the parameters are joined without
     intervening separators.

</quote>

I'm getting tired and bored of cut'n paste, are you not?


>So, in assignment, in bash, the only thing you can rely on in an
>assignment WRT to $* and $@ is:
>
>var="$*"
>
>The other ones are not documented and may have erratic effects
>that could change from a version of bash to another as it's not
>documented (ksh93 behavior is different, and POSIX is not
>clear on that point too, and if it makes things clearer, chances
>are that the specification will get adapted so that ksh93 is
>conformant):
>
>var=$*
>var=$@
>var="$@"
>
>Well, you can assume that as long as you don't change IFS, they
>will always result in the positional parameters joined with
>space.

0
A
2/6/2004 8:10:56 PM
2004-02-06, 22:10(+02), A Alper ATICI:
[...]
>>Note, to follow-up on my post on the other thread, that the fact
>>that in var="$@", the positional parameters are joined with
>>spaces is undocumented (in zsh, they are joined with the first
>>character of IFS, and it's documented)
>>
> No, you're failing again due to ignorance of bash info pages.
>
> Under special parameters heading:
>
> <quote>
> `@'
>      Expands to the positional parameters, starting from one.  When the
>      expansion occurs within double quotes, each parameter expands to a
>      separate word.  That is, `"$@"' is equivalent to `"$1" "$2" ...'.
>      When there are no positional parameters, `"$@"' and `$@' expand to
>      nothing (i.e., they are removed).
[...]

I can see no mention of "space" in the above. I can see that
"$@" expands to the list of positional parameters, but in the
context of an assignment to a string type variable, it makes no
sense (same in case statement, or [[ ]], of ${..#$@} and in many
other places). So, it has to be documented, and it's not, even
in the info page. That's simple enough, it's just a matter of �
in contexts where $@ can't expand to a list, then both $@ and
"$@" expand to the concatenation of positional arguments with
spaces inbetween, and $* expands to the concatenation of
positional parameters with the first char of IFS (or " " if IFS
is empty or unset) inbetween �.


>>bash-2.05b$ set a b c; IFS=,; a=$*; b="$*"
>>bash-2.05b$ echo "$a"
>>a,b,c
>>bash-2.05b$ echo "$b"
>>a,b,c
>>bash-2.05b$ IFS=; a=$*; b="$*"
>>bash-2.05b$ echo "$a"
>>a b c
>>bash-2.05b$ echo "$b"
>>abc
>>
>
> You assign null to IFS, and the behaviour conforms, well you guessed, to
> related info page anyway:
>
> <quote>
> `*'
>      Expands to the positional parameters, starting from one.  When the
>      expansion occurs within double quotes, it expands to a single word
>      with the value of each parameter separated by the first character
>      of the `IFS' special variable.  That is, `"$*"' is equivalent to
>      `"$1C$2C..."', where C is the first character of the value of the
>      `IFS' variable.  If `IFS' is unset, the parameters are separated
>      by spaces.  If `IFS' is null, the parameters are joined without
>      intervening separators.

Yes, and?

I was speaking of $*, $@, "$@" not documented in assignment in
that case. The part you quote speaks of "$*" for which I also
said that it was documented.

> </quote>
>
> I'm getting tired and bored of cut'n paste, are you not?

Could you please cut&paste a last one for me: the one that
explains why

in set a b c;IFS=",", a=$*, $a is "a,b,c"
while in set a b c;IFS="", a=$*, $a is "a b c"

(note that there are also serious bugs in UTF-8 locales with
non-ascii characters, but I guess UTF-8 support is still in a
very early alpha stage).

-- 
St�phane                      ["Stephane.Chazelas" at "free.fr"]
0
Stephane
2/6/2004 8:38:25 PM
On Fri, 6 Feb 2004 21:38:25 +0100, Stephane CHAZELAS
<this.address@is.invalid> wrote:
>>
>> Under special parameters heading:
>>
>> <quote>
>> `@'
>>      Expands to the positional parameters, starting from one.  When the
>>      expansion occurs within double quotes, each parameter expands to a
>>      separate word.  That is, `"$@"' is equivalent to `"$1" "$2" ...'.
>>      When there are no positional parameters, `"$@"' and `$@' expand to
>>      nothing (i.e., they are removed).
>[...]
>
>I can see no mention of "space" in the above. I can see that
>"$@" expands to the list of positional parameters, but in the
>context of an assignment to a string type variable, it makes no
>sense (same in case statement, or [[ ]], of ${..#$@} and in many
>other places). So, it has to be documented, and it's not, even
[...]

You seem to have a problem wrt "Expands to the positional parameters,
starting from one" statement, you may be right, and 
I'd say "have a look at arrays":

$ ary[0]=aa ary[1]=bb c=${ary[*]} d=${ary[@]}; echo $c; echo $d
aa bb
aa bb

If you agree an unseparated list is not an option in this case, then it
boils down to "why is it a space separated list?", but I regret I don't
have time to join that discussion.

Although I have not examined bash source code, it is obvious $* and $@ are
implemented as arrays, therefore their behaviour is not unreliable,
undocumented, erratic, etc to me. OTOH, I guess you've spotted a bash bug,
which is better obverved below:

$ set a b c; IFS=, a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b"
a b c
a,b,c
a b c
a,b,c

$ unset IFS
$ set a b c; a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b"
a b c
a b c
a b c
a b c

"$a" and "$b" exhibit "$*" specific behaviour as documented.
$a and $b expand to positional parameters starting from one, as in arrays.
So far so good.

$ set a b c; IFS= a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b"
a b c
a b c
abc
abc

Now, I'd expect 2nd and 3rd lines exchanged in the output above.
Unless there's a special case when IFS is null, this could be a bug, 
or I'm terribly wrong somewhere...

regards,


0
A
2/7/2004 2:24:39 PM
On Sat, 07 Feb 2004 at 14:24 GMT, A Alper ATICI wrote:
> 
> $ set a b c; IFS= a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b"
> a b c
> a b c
> abc
> abc
> 
> Now, I'd expect 2nd and 3rd lines exchanged in the output above.
> Unless there's a special case when IFS is null, this could be a bug, 
> or I'm terribly wrong somewhere...

   When $* is quoted, it's a single word; when it's not, each argument
   is a separate word, and $IFS is not used.

   You have assigned a single word, "abc" (the three arguments
   separated by the first character of $IFS, which is empty), to $b,
   but 3 words to $a.

   There's nothing wrong with the output; you might question why the
   three arguments were separated by spaces when assigned to
   $a. AFAICS, the separator is undefined. Once that's done, however,
   the output is entirely correct.

   The assignment to $b is well-defined, and once assigned, $b
   contains only a single word. There is no conceivable way that
   echoing "$b" or $b can produce anything but abc.

-- 
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License
0
Chris
2/8/2004 5:56:48 PM
On 8 Feb 2004 17:56:48 GMT, "Chris F.A. Johnson" <c.fa.johnson@rogers.com>
wrote:

>On Sat, 07 Feb 2004 at 14:24 GMT, A Alper ATICI wrote:
>> 
>> $ set a b c; IFS= a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b"
>> a b c
>> a b c
>> abc
>> abc
>> 
>> Now, I'd expect 2nd and 3rd lines exchanged in the output above.
>> Unless there's a special case when IFS is null, this could be a bug, 
>> or I'm terribly wrong somewhere...
>
>   When $* is quoted, it's a single word; when it's not, each argument
>   is a separate word, and $IFS is not used.
>

This explanation conflicts with the case when IFS=,

$ set a b c; IFS=, a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b"
a b c
a,b,c
a b c
a,b,c

$* is not quoted when assigned to a, however IFS is used in echo "$a"



0
A
2/8/2004 7:02:01 PM
2004-02-8, 17:56(+00), Chris F.A. Johnson:
[...]
>    When $* is quoted, it's a single word; when it's not, each argument
>    is a separate word, and $IFS is not used.
[...]

Only in list contexts, but in scalar assignments and various
other place, you can't have "separate words" as it's a string
context.

And then, it is undocumented, that was my point.

Note that in

printf '<%s>\n' $*

in Bourne shells, the fact that printf gets passed the list of
arguments is because $* is splitted according to IFS as any
other variable. $* is not a special variable in Bourne shell
(except that its value is dynamically built as the concatenation
of the positional parameters with spaces inbetween)

In Bourne shells:

set "a:b" "A B"
IFS=:
printf '<%s>\n' $*

gives:

<a>
<b A B>

(because $* is joined with spaces, and thus not splitted there)

In Bourne shell, $@ is exactly the same as $* except when inside
double quotes in list context in which case it is expanded to
the list of positional parameters:

$ printf '<%s>\n' $@
<a>
<b A B>
$ printf '<%s>\n' "$@"
<a:b>
<A B>

That's very simple and consistent. The zsh way is very similar
(when word splitting is activated).

In bash, you don't really know how it works. In cmd $*, it seems
that you always get the list of parameters (word splitted). If
you disable word splitting (IFS=), the arguments are preserved,
even the empty ones:

$ set "a b" "" "c d"
$ IFS=
$ printf '<%s>\n' $*
<a b>
<>
<c d>

That would indicate that the separation is not due to word
splitting. However, in

LANG=fr_FR.UTF-8 bash -c "
  set a b
  IFS=\$'\303\251' # � in UTF8
  printf %s, \$* | od -tc"
0000000   a 303   b   ,
0000003

There's a general confusion, in bash multibyte support between
"character" and "byte". Here it seems that the value of $* is
built as the positional parameters joined with the first *byte*
of IFS, and so is not word splitted because the result is a
string that doesn't contain the '�' *character*.

So, it seems that at least in some cases, you have a behavior
similar as the Bourne shell one.

>    You have assigned a single word, "abc" (the three arguments
>    separated by the first character of $IFS, which is empty), to $b,
>    but 3 words to $a.

You can't assign 3 words to a string-type variable, that makes
no sense. What you can do is assigning the concatenation of 3
words with whatever character inbetween.

-- 
St�phane                      ["Stephane.Chazelas" at "free.fr"]
0
Stephane
2/8/2004 7:46:38 PM
On Sun, 08 Feb 2004 at 19:02 GMT, A Alper ATICI wrote:
> On 8 Feb 2004 17:56:48 GMT, "Chris F.A. Johnson" <c.fa.johnson@rogers.com>
> wrote:
> 
>>On Sat, 07 Feb 2004 at 14:24 GMT, A Alper ATICI wrote:
>>> 
>>> $ set a b c; IFS= a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b"
>>> a b c
>>> a b c
>>> abc
>>> abc
>>> 
>>> Now, I'd expect 2nd and 3rd lines exchanged in the output above.
>>> Unless there's a special case when IFS is null, this could be a bug, 
>>> or I'm terribly wrong somewhere...
>>
>>   When $* is quoted, it's a single word; when it's not, each argument
>>   is a separate word, and $IFS is not used.
>>
> 
> This explanation conflicts with the case when IFS=,
> 
> $ set a b c; IFS=, a=$* b="$*"; echo $a; echo "$a"; echo $b; echo "$b"
> a b c
> a,b,c
> a b c
> a,b,c
> 
> $* is not quoted when assigned to a, however IFS is used in echo "$a"

   No, IFS is used in the assignment to $a. As I said, when $* is not
   quoted, the separator is undefined. Apparently, it uses a space
   when IFS="", otherwise it uses the first character of $IFS.

   The output is exactly as it should be, given the values assigned
   to $a and $b.

man bash:

       echo [-neE] [arg ...]
              Output the args, separated by spaces, followed by a
              newline.


   When IFS=",", $a and $b are both read as three arguments (they both
   contain "a,b,c"), "$a" and "$b" are read as one argument.

$ set a b c; IFS=, a=$* b="$*"; IFS=; echo $a; echo "$a"; echo $b; echo "$b"
a,b,c
a,b,c
a,b,c
a,b,c


-- 
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License
0
Chris
2/8/2004 7:57:33 PM
On 8 Feb 2004 19:57:33 GMT, "Chris F.A. Johnson" <c.fa.johnson@rogers.com>
wrote:

[...]
>
>       echo [-neE] [arg ...]
>              Output the args, separated by spaces, followed by a
>              newline.
>
>
>   When IFS=",", $a and $b are both read as three arguments (they both
>   contain "a,b,c"), "$a" and "$b" are read as one argument.
>
>$ set a b c; IFS=, a=$* b="$*"; IFS=; echo $a; echo "$a"; echo $b; echo "$b"
>a,b,c
>a,b,c
>a,b,c
>a,b,c


Aaaargghhh !  Word-splitting... 
It was always there, while I totally overlooked it (allegedly new semantics
of IFS within special parameters fooled me into oblivion).
All right, thank you very much.


0
A
2/8/2004 11:08:03 PM
Reply:
Similar Artilces:

Class Member Data and Member Function Parameters
Hello: First, if this is one of those "questions asked a million times" just say so and I'll dig a little deeper. If not, then... I'm curious, is it typical to use member data (properties, attributes, etc.) as parameters to the class's member functions or would you normally have parameters that are not data members of the class? Or is it normally a combination, just depending on circumstances? Did I make sense? If anyone knows of any books that talk about this, I'd appreciate a title, etc. I guess I'm asking which is the better design. Example: Is it bett...

parameter files
I have a python module (file) that has a set of parameters associated with it. Let's say the module is called "code.py." I would like to keep the parameter assignments in a separate file so that I can save a copy for each "run" without having to save the entire code.py file. Let's say the parameter file is called "parameters.py." Normally, code.py would simply import the parameters.py file. However, I don't want the parameters to be accessible to any other file that imports the code.py file. to prevent such access, I preface the name of each parameter...

wxpython: how do i write this without the id parameter?
I was reading in the wxPython wiki that most of the time you don't have to include the id parameter at all, and you can just use keyword arguments for other parameters. But I'm having trouble converting this code into that method (i.e., without the id parameter). I keep getting errors that involve wrong parameters, or that they are out of order, etc. So I'm hoping someone can show me how to re-write the constructors for InputForm and wx.Frame, as well as the __init__ method, so that they will just deal with parent and title. Also, the two buttons have an id parameter, but l...

Parameter Help
I am tying to set a parameter in a query that will only slect cutomer codes between two given #'s. I have a 3 part query....... 1st I am querying the customer codes that have a current balance. Then I am using a crosstab pulling from that query to get the current, over 30, over 60, etc.... and then I am putting that in another query to get the company names and addresses for my report. I am unable to specify the cutomer codes by a parameter without getting The Microsoft Jet database engine does not reconize '[Enter Customer Code]' as a valid field name or expression. HELP I am...

List parameters
Hi, I try this code: template <typename T> inline T const& max(T const& a, T const& b) { return a<b?b:a; } template <typename T, ... list> inline T const& max(T const& a, T const& b, list const& x) { return max(a, max(b, x)); } But it not compile. I have this message: "error: expected identifier before '...' token" I saw this sample in book "c++ templates: the complete guide" i use wxWidgets with gcc compiler. Is this code legal? is it compile? If no how use list parameters in te...

2 quick questions: How do I make a function that will use an input parameter to open a file?
I am currently running the function [Sharpe, Win%, Loss%, CumRet] = pairtrade(lcap,scap,lentry,sentry,k,f) I want to change this function to: [Sharpe, Win%, Loss%, CumRet] = pairtrade(lcap,scap,lentry,sentry,k,f, PEP) so that when i run this function the very next line is: fid=fopen('V:\Desktop\PEP.csv') This is already saved in 'V:\Desktop\PEP.csv However, I want this as a variable so that if I do: [Sharpe, Win%, Loss%, CumRet] = pairtrade(lcap,scap,lentry,sentry,k,f, KO) the very next line will be fid=fopen('V:\Desktop\KO.csv') Basically I want the ending to t...

length as parameter to makebox
Could some kind soul please explain to me how i can achieve the following: \newlength{\zblen}{51mm} \makebox[\zblen][l]{ ...} I would like to do that because i've got a number of such makebox'es throughout my document, all the same width, and i would like to be able to define that width in one place. (Quick googling and a search of the FAQ didn't turn anything up -- surely i'm not the first one who has this question? ) TIA, Gabriel. On Dec 12, 8:30 pm, snnopy67 <snoopy.6...@googlemail.com> wrote: > Could some kind soul please explain to me how i can achieve ...

NLS Database Parameters vs. NLS Instance Parameters
Hi, What is the difference between NLS_DATABASE_PARAMETERS and NLS_INSTANCE_PARAMETERS? Craig. -- Canberra, Australia Researching: BURTENSHAW, BURTONSHAW - Kent, England. MCGINN - Holytown, Scotland BARCLAY - Old Monkland, Scotland. CUTHBERT, CALDER, GORDON - Dundee, Scotland, DELOHERY/CARMODY - Co. Clare, Ireland > NSW, Aus. KERR - SCT>AUS O'CARROLL - Kilkenny, Ireland > QLD, Aus. WELLING - Middlesex/London, England HAYES - Australia BULLER - Middlesex/London or Devon, England. DIXON - Middlesex/London, England OTWAY/OTTWAY - Middlesex/Londo...

SubQuery parameter for report
I've got a report whose recordsource is a query: SELECT [Company Information].Company, qryGatherCreditCardInfoFromCallRecords.* FROM qryGatherCreditCardInfoFromCallRecords LEFT JOIN ([Number Cross Reference] LEFT JOIN [Company Information] ON [Number Cross Reference].[Property Code]=[Company Information].[Property Code]) ON qryGatherCreditCardInfoFromCallRecords.[Number ID]=[Number Cross Reference].[Number ID]; The subquery, qryGatherCreditCardInfoFromCallRecords, takes 1 parameter, [strCreditCardNo]. When opening this report via VBA, how can I pass a value to this parameter, then open...

Parameter passing problem !!!
Hi, I have a simple problem with passing a variable from one class to another. Basically the variable is calculated in a listerner event, passed from that class to another and displayed. I have the program running and compiling, although the end result is not what it should be. I always get the end result of 0 instead of a calculated result. The user must choose a type either adult, child, student then enter a number in the text field then click confirm which will bring up result with how much it will cost. First class CalculcatePanel [code] public class CalculatePanel extends JPanel{ ...

Model Parameter Configuration does list parameters
Hello, I am building an rsim target and when I review Simulation-->Configuration Parameters-->Optimization-->Configure I don't see any of the model parameters being listed. I have a few constants which I thought would be listed. However when I review the example rtwdemo_rsim_param_tuning.mdl it has the parameters listed under "Model Parameter Configuration" Can some help me to understand what I need to add to make the parameters appear under "Model Parameter Configuration" table ...

resursive wildcard expansion
Hello, I've just had an idea to extend the shell. **r on the end of a glob could make the expansion recursive. ** is redundant to is available syntax and backwards compatible. Recursive expansion would be really useful as find . -name \*.text -exec echo {} \; etc.. is awkward. $ls *.txt**r a.txt docs/b.txt more/c.txt Gene Thomas http://genethomas.com gene@genethomas.com Am Mittwoch 23 September 2009 00:28, Gene a écrit : > I've just had an idea to extend the shell. **r on the end of a > glob could make the expansion recursive. See "Recursive Globbing" in zs...

Dynamic parameter names in xsl
Hi! I have an application that generates an html-form from an xml-file using an xsl-file. My problem is that I want the xsl to use some "unknown" parameters that I pass to the xslt processor before processing the xml. The parameters are not totally unknown but they are not static, they are built by an attribute in the xml and a constant name. Is it possible to define a "runtime" parameter and use the value passed to the xslt processor? xsl example: .... begin code ... <!-- BUILD PARAMETER NAME --> <xsl:variable name="param_name"><xsl:value-of sel...

something about template template parameter!!!
when i compile source code from <C++ templates> page 50 #include <iostream> #include <deque> using namespace deque; template <typename T, template<typename ELEM> class CONT = std::deque> { private: CONT<T> elems; public: ...... }; int main() { ..... } i compile it using c++ compiler from Microsoft Visual Studio 2005,it returns error c3201,according to MSDN,it means"the template parameter list for class template 'template' does not match the template parameter list for template parameter 'template'" but when i compile ...

i18n parameters
Hi, I have losing my i18n file and i search parameters for US parameters and 8bit ISO charsets. Regards Philippe pcouas@infodev.fr wrote: > Hi, > > I have losing my i18n file and i search parameters for US parameters > and 8bit ISO charsets. > > Regards > Philippe Right - which means? -- Regards, Frank van Bortel "Frank van Bortel" <frank.van.bortel@gmail.com> wrote in message news:dc327c$ulq$1@news5.zwoll1.ov.home.nl... > pcouas@infodev.fr wrote: >> Hi, >> >> I have losing my i18n file and i search...

Constraints on parameters
Hi, I am currently trying to solve a system of ode with my experimental data. The two odes has the form: dy1/dt = k1*y1^a*y2*b dy2/dt = k2*y1^a*y2*b where y1 and y2 are experimental data and k1, k2, a and b are parameters to be solved and a and b has to be positive. I have used the interface I read http://www.mathworks.de/matlabcentral/newsreader/view_thread/151698 using the interfaz_ode_ajuste. I was able to solve the parameters, however the parameters returned as imaginary numbers. Does anyone knows if there are program/codes that i can use, so i can restrain the values ...

Rainbowcrack parameter optimization
I am working on defining the parameters for optimization of Rainbowcrack table generation. If you can assist please email me and we can discuss further. The following paper is useful in determining the optimization for the rainbow tables: Parameter optimization of time-memory trade-off cryptanalysis in RainbowCrack http://www.antsight.com/zsl/rainbowcrack/optimization/optimization.htm ...

variable parameters in Metapost?? ( default parameters ??)
hi guys: I want to write a function in MetaPost that takes 1 or 2 parameters, if it sees only 1 parameter, it does something, if it sees 2, it does something else ..... is a way to do this?? thanks a lot Yang Am Sun, 30 Jan 2005 11:52:56 -0800 schrieb lilostitch: > hi guys: > I want to write a function in MetaPost > that takes 1 or 2 parameters, > > if it sees only 1 parameter, it does something, > if it sees 2, it does something else ..... > is a way to do this?? thanks a lot def macro(text t) = begingroup; save a, b, d, n, r ; n := 0 ; d := 50 ; % default valu...

inferred template function parameters
Can anyone out there tell me why the compiler cannot infer the template parameters in the following code? template <typename T, int N> int array_length(const T val[N]) { return N; } int main() { int v[100]; cout << array_length(v) << endl; return 0; } [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] "Dave" <dcnurser@hotmail.com> wrote in message news:41a07ca8@news.comindico.com.au... > > Can anyone out there tell me why the compiler cannot infer the tem...

Blocking expansion of parameter
Hello, I'm not very experienced in TeX programming. I'd like to define a LaTeX command, which writes the second argument as it is given to a file for later usage. For that i have to block expansion of the argument. My current code is as follows: \newwrite\tov\openout\tov=\jobname.tov \newcommand{\mysymb}[3]% {\newcommand{#1}{\ensuremath #2}\write\tov{$\noexpand#2$&#3\noexpand\\}} e.g. \mysymb{\xzdot}{\dot{x}_0}{}{} So the output is: $\dot {x}_0$&\\ But for \mysymb{\tN}{\tilde{t}}{Time, normalized}{} \mysymb{\vphideltattN}{ \varphi_{\delta,\tN\tN}}{}{} the result is: ...

mle problem with parameter interval
Hi, I'm trying to estimate parameters of this pdf : pdfc=@(t,k,t0)0.1465*exp(-(abs(t./t0)).^k); on a given observation t. For that purpose I use maximum likelihood estimation (mle) on matlab like this : [phat,pci]=mle(t,'pdf',pdfc,'start',[1.667,1.4],'lower',[0,0],'upper',[4,3]); I get the initial k and t0 from another method that we develop using linear least-square fit. This initial values had been checked and qualitatively shows the pdf curve can follow the distribution of t. The problem here is that the estimated t0 from mle always take the upper l...

unknown input parameter
Hi all, My problem is simple. Matlab does not recognize a variable that is part of the input parameter list. I'm writing a simple matlab code using function handles and subfunction. The main function is analytical_solutions and it calls X = lin_add_1d_sol(t). This last one calls y = wiener_process(t). The problem is that matlab does not recognize "t". The error is the following: ??? Input argument "t" is undefined. Error in ==> analytical_solutions>wiener_process at 32 y = y+feval(sqrt_lambda, j)*feval(f,t,j)*Z(j); Error in ==> analytical_solut...

SOAP request parameters
Hi, I have a problem with Ruby SOAP client. Basically, I create new client instance via SOAP::RPC::Driver.new, then I use add_method('method', 'param1', 'param2') and then try to call the method - soap.method('value1', 'value2'). The problem is that instead of the values, parameter names ("param1" and "param2") are sent to the server... Can anybody please tell me what am I doing wrong? Thanks. -- Posted via http://www.ruby-forum.com/. ...

TI Tools ac30 parameter -p
Hmm I have problems using the ac30 statement -p Compile all input modules to one output module. This is something very interesting, but I can not figure out how to pass more than one input module ac30 file.c otherfile.c -p always uses otherfile.c as outputfile which is not nice :) Anybody has a clue how to pass more than one input file. And please don't suggest cl30. Thanks Sascha ...

constraining parameters of betafit.
Hi, I want to apply the betafit command to some data. I also want to constrain the model to be unimodal. Therefore the a,b parameters returned must both be greater than 1. Any ideas how to constrain the maximum likelihood to accomplish this? Thanks. Why would you want to do this? If the ML estimator turns out to have one or both of a or b less than one, doesn't that suggest that a unimodel beta distribution is not a good representation of the data? However, if you insist on doing it, it is fairly easy to write the likelihood function for a beta distribution and pass it to ...