From owner-help-octave at bevo dot che dot wisc dot edu Thu Jan 11 12:33:57 1996 Subject: Re: strings From: cfm at camorra dot sth dot ruhr-uni-bochum dot de (Christoph Mecklenbraeuker) To: corbeil at allsparc dot ct dot tsc dot com (Allan Corbeil) Cc: acorbeil at tsc dot com, help-octave@bevo.che.wisc.edu (Mailing List Octave) Date: Thu, 11 Jan 1996 19:30:56 +0100 (MET) Hi Allan, You asked: > In octave, I can't seem to define 2-D string arrays. > I also cannot do simple subscripting. For example: > str=["abc";"def"] > s1=str(1:2) > Can anyone help. There exists an internal Octave variable called implicit_str_to_num_ok which can be set to "true" octave:1> implicit_str_to_num_ok = "true"; After you have set this, you can define octave:2>str = ["abc";"def"] str = 97 98 99 100 101 102 where the matrix str is automatically converted to numeric type. Now octave:3> s1=str(1:2) s1 = 97 100 works if you have set the variable do_fortran_indexing = "true" If you want to set the type of a variable from 'numeric' to 'string', you can use the function setstr() octave:4> s2 = setstr(str) s2 = adbecf But this is maybe not what you want? > Also do the equivalent of MEX files exist for octave? Yes they do, but do not work on every system. They are called 'dynamically linked functions' and you need the GNU dynamic linker 'dld'. In my octave 1.1.0 manual you can find the relevant info in section 5.8 All the best, Christoph ============= email: cfm at sth dot ruhr-uni-bochum dot de ======================= Christoph Mecklenbraeuker | Lehrstuhl f. Signaltheorie (IC 5/35) | Tel: +49(234) 700 6119 Ruhr Universitaet Bochum | Fax: +49(234) 709 4261 D-44780 Bochum, Germany | ======== http://www.sth.ruhr-uni-bochum.de/sth/whois/cfm/cfm.html =====