Indexing via 3d array changed behaviour 2015a -> 2015b?
Show older comments
Hi all, just got 2015b, here's a strange one where indexing via a multidimensional array has a differently shaped output to previous versions:
Code:
a = 1:10;
b = reshape(4:6,1,1,[]);
a(b)
2015a and before:
ans(:,:,1) =
4
ans(:,:,2) =
5
ans(:,:,3) =
6
2015b:
ans =
4 5 6
I searched through the release notes and couldn't find anything that relates to this behaviour change. Did I miss something? Or is this a bug that I should report?
1 Comment
David Young
on 15 Oct 2015
I really hope someone answers this! It's very worrying that something as fundamental as array indexing might have quietly changed between versions. Of course the underlying problem is the inconsistent way indexing is applied to A(B) if both A and B are vectors. Since in this case isvector(b) returns 0, I think that the pre-2015b results are "correct", so to me it looks like a bug.
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!