String vector from argv
John W. Eaton
jwe at bevo.che.wisc.edu
Wed Apr 16 11:33:10 CDT 2008
On 14-Apr-2008, Oka Kurniawan wrote:
| Hi
| I am trying to cat a string that I obtain from argv. But I got this error
|
| error: strcat: all arguments must be strings
| error: evaluating if command near line 38, column 3
| error: called from `strcat' in file
| `/home/kurniawano/Programs/Octave3/share/octave/3.0.0/m/strings/strcat.m'
| error: evaluating assignment expression near line 12, column 11
| error: evaluating if command near line 2, column 1
|
| This is my code
|
| fname=argv()(1,:);
| fnameout=strcat(fname,".p");
|
| I checked that argv should return vector string. But it seems that it
| cannot be concatenated using strcat. Should I convert it or anything?
|
| anyone have any idea?
The argv function returns a cell array of character strings. Indexing
a cell array with () returns a cell array. If you want an individual
element of the cell array, index it with {}:
fname = argv(){1};
jwe
More information about the Help-octave
mailing list