From bug-octave-request at bevo dot che dot wisc dot edu Fri Apr 10 11:15:06 1998 Subject: Re: making a string global malfunctions From: "John W. Eaton" To: Dirk Eddelbuettel Cc: Michael Smolsky , bug-octave@bevo.che.wisc.edu Date: Fri, 10 Apr 1998 11:14:42 -0500 (CDT) On 10-Apr-1998, Dirk Eddelbuettel wrote: | You discovered a misfeature of 2.0.10 which was fixed in 2.0.11. If you | upgrade to Octave 2.0.11, you will see that it behaves as expected: Are you sure? I can still duplicate the problem with --traditional, but I don't think it's really a bug. The problem is that now with --traditional, global variables are initialized to `[]', and implicit_str_to_num_ok is initialized to 1. This combination causes global a to initialize a to an empty matrix, and since a([1,2],:)=str2mat('red','yellow'); is assigning strings to a numeric matrix using indexing, Octave attempts to convert the RHS to numeric values, and that succeeds because of the setting of implicit_str_to_num_ok. But hey, it's Matlab-compatible (except that Matlab's deblank function just warns if you try to deblank a numeric value instead of making it an error). So, I don't plan to change the behavior here (beyond whatever changes happened from 2.0.10 to 2.0.11). If you want it to work as you expect, I suggest you use some other set of preference variables. jwe