Fri 17 Jul 2015 10:54:58 AM UTC, comment #10:
Thanks, works fine again!
|
Thu 16 Jul 2015 07:20:24 PM UTC, comment #9:
OK, thanks. I checked in the following changeset:
http://hg.savannah.gnu.org/hgweb/octave/rev/b9bd8786d310
|
Thu 16 Jul 2015 06:55:20 PM UTC, comment #8:
From my understanding of the MEX API in MATLAB, the same goes for most other mx functions: they dont explicitly check for NULL pointers, it is up to the caller to not pass nulls.
|
Thu 16 Jul 2015 06:50:56 PM UTC, comment #7:
yes, that will crash MATLAB (access violation).
|
Thu 16 Jul 2015 06:47:56 PM UTC, comment #6:
Oh, so I misunderstood. It's not about dims == NULL, it's about ndims == 0?
I guess maybe there should also be a defensive check for dims == NULL in there somewhere anyway...
I'm curious though, does Matlab crash or issue an error or a warning for something like this:
?
|
Thu 16 Jul 2015 06:34:03 PM UTC, comment #5:
Here is a test:
In MATLAB, I get the following:
|
Thu 16 Jul 2015 06:29:06 PM UTC, comment #4:
Does the attached change work?
(file #34454)
|
Thu 16 Jul 2015 06:13:56 PM UTC, comment #3:
So I suppose the logic should be
is that correct?
|
Thu 16 Jul 2015 06:00:29 PM UTC, comment #2:
This changeset creates a new incompatibility with MATLAB:
MATLAB returns a 10x1 array while Octave now returns a 10x0 one.
|
Mon 15 Jun 2015 04:21:25 PM UTC, comment #1:
Technically, all Matlab mxArray objects have two dimensions. According to the documentation for mxCreateNumericArray (http://www.mathworks.com/help/matlab/apiref/mxcreatenumericarray.html) for the ndim argument:
So correct code for an empty matrix is to specify ndims = 2, with dims[0] = 0, dims[1] = 0. This will work in Octave or Matlab.
I have changed Octave to be Matlab-compatible if the ndims < 2. See this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/2691947f5409). This will be a part of the next bug fix release 4.0.1. Until then you can use the workaround above, or get the code from the stable branch of Octave's Mercurial repository and build Octave for yourself.
|
Sun 14 Jun 2015 09:26:11 AM UTC, original submission:
Take the following MEX-function:
and run it:
In Octave, this creates a scalar array initialized to 0,
i.e size(out) = [1 1], similar to double(0)
In MATLAB, this creates an empty array,
i.e size(out) = [0 0], similar to double([])
I'm using the official Octave installer, and the latest MATLAB R2015a.
|