From help-octave-request at bevo dot che dot wisc dot edu Sun Dec 29 23:36:55 2002 Subject: Strings not compatible with Matlab? From: James Frye To: help-octave at bevo dot che dot wisc dot edu 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? James % 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)); end endfunction ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------