Admittedly I've been including this patch in my mxe crossbuilds ever since July '16 but never came back to this bug report.
JWE noted additional tests are required as well.
AFAIR mldivide's behavior should still be patched as well, see comment #7. I just checked this in Matlab r2017a prerelease:
..while Octave (with John's patch) does:
(BTW where do those empty lines in Octave come from? they started appearing some months ago)

Patch works fine in Linux now, but indeed, when A is any 2D array, patched Octave will accepts constructs like
1 / A
and
mrdivide (1, A)
that Matlab doesn't accept. So I guess merely checking for number of dimensions should do the trick.
mldivide won't accept (A, 1), nor (if B = 3D array) (B, 1). The former should be OK, the latter not.

Thanks John.
As the Matlab docs are unclear about right division by an array of arbitrary dimensions, I experimented a bit more.
It turns out that mrdivide, rdivide and "/", and for that matter, mldivide too, all perform elementbyelement division for anything except square matrices. Obvious as that's the only useful outcome for arbitrary arrays.
Matlab r2016b prerelease:
+verbatim
>> format long
>> format compact
>> MX = rand (3, 3, 3)
MX(:,:,1) =
0.327565434075205 0.833500595588975 0.861980478702072
0.671264370451740 0.768854252429615 0.989872153631504
0.438644982586956 0.167253545494722 0.514423456505704
MX(:,:,2) =
0.884281023126955 0.199862822857452 0.825583815786156
0.588026055308498 0.406954837138907 0.789963029944531
0.154752348656045 0.748705718215691 0.318524245398992
MX(:,:,3) =
0.534064127370726 0.136292548938299 0.189710406017580
0.089950678770581 0.678652304800188 0.495005824990221
0.111705744193203 0.495177019089661 0.147608221976689
>> (1 / MX)  mrdivide (1, MX)
ans(:,:,1) =
0 0 0
0 0 0
0 0 0
ans(:,:,2) =
0 0 0
0 0 0
0 0 0
ans(:,:,3) =
0 0 0
0 0 0
0 0 0
>> (1 / MX)  rdivide (1, MX)
ans(:,:,1) =
0 0 0
0 0 0
0 0 0
ans(:,:,2) =
0 0 0
0 0 0
0 0 0
ans(:,:,3) =
0 0 0
0 0 0
0 0 0
>> (1 / MX)  mldivide (MX, 1)
ans(:,:,1) =
0 0 0
0 0 0
0 0 0
ans(:,:,2) =
0 0 0
0 0 0
0 0 0
ans(:,:,3) =
0 0 0
0 0 0
0 0 0
verbatim
For square matrix:
Octave4.1.0+ does:
+verbatim
>> 1 / MX
error: operator /: nonconformant arguments (op1 is 1x1, op2 is 3x9)
>> mrdivide (1, MX)
error: mrdivide: operator /: nonconformant arguments (op1 is 1x1, op2 is 3x9)
>> rdivide (1, MX)
ans =
ans(:,:,1) =
3.05282516399582 1.19975919068585 1.16011908008143
1.48972602154801 1.30063662500396 1.01023146911583
2.27974795038665 5.97894649731989 1.94392379926188
ans(:,:,2) =
1.13086221896275 5.00343178237420 1.21126405445310
1.70060491533044 2.45727512917771 1.26588202497301
6.46193746773186 1.33563825635417 3.13947843671169
ans(:,:,3) =
1.87243431780963 7.33715825105533 5.27119213432779
11.11720349048724 1.47350858890021 2.02017824743730
8.95209111422619 2.01947982529240 6.77469037028254
>> mldivide (MX, 1)
error: mldivide: operator \: nonconformant arguments (op1 is 3x9, op2 is 1x1)>>
verbatim
Is "Matlab compatibility" the proper Item Group or should it rather be one of "Feature request", "WTF, Matlab?!?" or "Incorrect result"?
And do you want a separate bug report for the ND to 2x2 array conversion?
<title adapted>

Matlab r2016b prerelease accepts "1 / rand (5, 5, 5);"
I'm unsure about how to interpret this but it seems to work fine in Matlab.
In Octave:
I don't know if this qualifies as a bug or just a Matlab feature not (yet?) implemented in Octave; provisionally I assumed the latter.
Octave's error message suggests the second & third dimension of "rand (5, 5, 5)" aren't recognized properly; does that suggest a different bug?
To be sure, Matlab in turn doesn't accept a simple 2D matrix at the RHS:
At least Octave and Matlab agree there :)
I hit this when trying out reducepatch.m (patch #8912) with the examples from Matlab itself.
(Mageia5 64b, hg id ef91e43f162a "set DLL ....")
