Code covered by the BSD License  

Highlights from
PIVMat 3.02

image thumbnail

PIVMat 3.02

by

 

27 Apr 2006 (Updated )

A PIV Post-processing and data analysis toolbox

getvar (PIVMat Toolbox)
getvar (PIVMat Toolbox)
PIVMat Function Reference<< Prev | Next >> 
getvar
Get the value of the parameters in a string 'p1=v1_p2=v2_...'

Description
S = getvar(STR), where the string STR is in the form 'p1=v1_p2=v2_...', 
returns a structure S containing the variables built from STR, with 
S.p1=v1, S.p2=v2, etc.  If the substrings separated by '_' do 
not contain any '=', the first block of alphanumeric characters stand 
for the variable name, and the remaining of the substring is the value 
for that variable. If the substrings consist only of alphanumerics or 
digits, then a generic variable name in the form 'varxx' is generated. 
 
This function is useful to read the parameters stored into filenames. 
 
Example
 
   getvar('050211_180_dt18.5_h0=80_mode=drop') 
        var1: 50211 
        var2: 180 
          dt: 18.5000 
          h0: 80 
        mode: 'drop' 
 
If STR is a cell array of string, getvar loops over each element and 
returns a cell array of structures. 
 
VAR = getvar(STR, VARNAME) returns the value of the variable VARNAME. 
VAR = getvar(STR, N) returns the Nth variable. 
 
Example
 
   getvar('a12_b3_c5...','b') 
      3 
 
The variables are converted to numeric whenever a numeric conversion 
is possible. To keep all variables as strings, specify 'strings' as the 
3rd parameter: getvar(STR, VARNAME, 'strings'). (use VARNAME=[] if you 
do not specify any VARNAME). 
 
Examples
 
   getvar('050211_180_dt18.5_h0=80_mode=drop','dt') 
      18.5000 
 
   getvar('050211_180_dt18.5_h0=80_mode=drop','dt','strings') 
      '18.5' 
 
See Also
getattribute, getfilenum. 
 
Published output in the Help browser 
   showdemo getvar 

 Previous: getsetnameNext: gradientf 

2005-2013 PIVMat Toolbox 3.02

Contact us