help-octave
[Top][All Lists]
Advanced

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

String vector from argv


From: John W. Eaton
Subject: String vector from argv
Date: Wed, 16 Apr 2008 12:33:10 -0400

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


reply via email to

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