[Top][All Lists]

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

Strings not compatible with Matlab?

From: James Frye
Subject: Strings not compatible with Matlab?
Date: Sun, 29 Dec 2002 21:35:36 -0800 (PST)

Here's another Matlab compatability problem.  The scripts we have pass
arguments as string/value pairs, for instance

  foo ("bar", 1);

Function foo then scans its arguments, matching the values to variables
corresponding to the strings, so that variable bar would be set to 1.

This doesn't work in octave.  Arrays of strings seem to be treated as
though the strings were being concatenated into one long array of
characters.  If I call the test program below as

  args ("hello");

it says that it's getting 5 arguments, each being one character of
"hello".  I get similar behavior with internally-defined arrays of 
strings.  Suggestions?


% test function to echo string arguments

function args (argv)

argc = length (argv);
printf ("argc = %d\n", argc);

for i = 1:argc
  printf ("arg %d = %s\n", i, argv (i));

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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