Matlab 2016b Matrix Dimensions for addition and subtraction?
1 view (last 30 days)
Show older comments
In previous version of Matlab if I type:
>> a = [1 2; 3 4]; >> b = [1;3];
and then attempt to execute:
>> a - b
I get an error (as I should) because the matrix dimensions don't agree.
However, if I attempt this in 2016b I get:
>> a-b
ans =
0 1
0 1
Is this a new feature? Is this seen as an improvement? If so, can I turn this off? I feel this is dangerous.
Thanks,
-mcd
0 Comments
Accepted Answer
James Tursa
on 10 Oct 2016
Edited: James Tursa
on 10 Oct 2016
Yes, this is a new feature and is intentional. See this link under Implicit Expansion:
I don't see anything in the release notes that indicates you can shut this off. It is basically bsxfun that has now been implemented directly into the language.
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices 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!