help-octave
[Top][All Lists]

## Re: M_MAP tools

 From: John W. Eaton Subject: Re: M_MAP tools Date: Wed, 19 Jul 2006 14:25:23 -0400

```On 18-Jul-2006, David Bateman wrote:

| 1) Octave doesn't yet have private directorys, so you have to also do

And be sure that the names of the private functions don't overlap with
the names of other functions...

| 2) There seems to be an issue of logical indexing in private/mu_util.m
| where octave doesn't recognize a vector of 1's and 0's as logical
| indexing, where matlab does. This seems to be a subtile incompatiability
| between matlan and octave, though in the assignment to a logical array
| of a 1 or a 0 doesn't change the type, though in octave it does. Consider
|
|
| >> i = logical(ones(1,4))
|
| i =
|
|      1     1     1     1
|
| >> i(1) = 0
|
| i =
|
|      0     1     1     1
|
| >> whos i
|   Name      Size                    Bytes  Class
|
|   i         1x4                         4  logical array
|
| Grand total is 4 elements using 4 bytes
|
| whereas in octave this gives
|
|
| octave:2>  i = logical(ones(1,4))
| i =
|
|   1  1  1  1
|
| octave:3> i(1) = 0
| i =
|
|   0  1  1  1
|
| octave:4> whos i
|
| *** local user variables:
|
|   Prot Name        Size                     Bytes  Class
|   ==== ====        ====                     =====  =====
|    rwd i           1x4                         32  double
|
| Total is 4 elements using 32 bytes
|
| John what do you want to do with this incompatiability? My solution in
| the context of m_map was to cast as a logical before using it. That is
|
| indx = logical(indx)
|
| at line 109 of private/mu_util.m