octave-maintainers
[Top][All Lists]
Advanced

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

Re: Matlab-compatible string class


From: Richard Crozier
Subject: Re: Matlab-compatible string class
Date: Sat, 30 Dec 2017 09:24:47 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0



On 29/12/17 13:25, John W. Eaton wrote:
On 12/28/2017 07:57 PM, Richard Crozier wrote:


On 28/12/17 16:41, Rik wrote:
On 12/27/2017 09:38 PM, address@hidden wrote:


I don't see a smooth transition path either.  Although Matlab presents the string class as a fundamental data type, it is actually closer to a container data type like a cell array.  In fact, by using cell arrays of strings you can make portable code that will run in either Octave or Matlab.  Maybe this is unkind, but the principal advantage seems to be the syntactic sugar of using parentheses '()' for indexing rather than cell array indexing '{}'.


I believe you can also do things like:

x = "the cat " + "sat on the mat"

which is kind of handy. More like a python string.

This could have also been done with character arrays.  Except that the original design of Matlab chose to have character arrays work like numbers when used with arithmetic operators.

jwe

Definitely true, and I guess the string class is their way of trying to fix this while maintining backward compatibility.

Richard


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.




reply via email to

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