From octave-maintainers-request at bevo dot che dot wisc dot edu Thu Nov 21 12:30:56 1996 Subject: Error with the expression b' when b is a string From: "John W. Eaton" To: ged at ireq dot ca Cc: octave-maintainers at bevo dot che dot wisc dot edu Date: Thu, 21 Nov 1996 12:30:31 -0600 On 21-Nov-1996, ged at ireq dot ca wrote: : The following expressions are working without errors with octave 1.1.1 : : octave:1> implicit_str_to_num_ok =1 : implicit_str_to_num_ok = 1 : octave:2> b='hello' : b = hello : octave:3> b' : error: octave_base_value::hermitian(): wrong type argument `string' : error: evaluating unary operator `'' near line 3, column 1 : error: evaluating assignment expression near line 3, column 1 Please try the following patch. It will make Octave actually transpose the string (no matter what the value of implicit_str_to_num_ok). If you really want to convert it to numeric ASCII values, you will have to use toascii now in addition to the transpose operator. Thanks, jwe Index: ov-str-mat.h =================================================================== RCS file: /home/jwe/src/master/octave/src/ov-str-mat.h,v retrieving revision 1.7 diff -c -r1.7 ov-str-mat.h *** ov-str-mat.h 1996/11/11 02:39:25 1.7 --- ov-str-mat.h 1996/11/21 18:25:37 *************** *** 102,107 **** --- 102,113 ---- string string_value (void) const; + octave_value transpose (void) const + { return octave_value (matrix.transpose (), true); } + + octave_value hermitian (void) const + { return octave_value (matrix.transpose (), true); } + void print (ostream& os, bool pr_as_read_syntax = false); int type_id (void) const { return t_id; } Index: ov-ch-mat.h =================================================================== RCS file: /home/jwe/src/master/octave/src/ov-ch-mat.h,v retrieving revision 1.5 diff -c -r1.5 ov-ch-mat.h *** ov-ch-mat.h 1996/11/07 16:47:00 1.5 --- ov-ch-mat.h 1996/11/21 18:19:18 *************** *** 116,121 **** --- 116,127 ---- octave_value convert_to_str (void) const { return octave_value (matrix); } + octave_value transpose (void) const + { return octave_value (matrix.transpose ()); } + + octave_value hermitian (void) const + { return octave_value (matrix.transpose ()); } + void print (ostream& os, bool pr_as_read_syntax = false); int type_id (void) const { return t_id; }