Changes with array operations in 2016a prerelease vs 2016a?

1 次查看(过去 30 天)
Anyone notice or find documentation on changes to matrix operations functionality between 2016a pre-release and full version, specifically for element-by-element binary operations (versus having to use the bsxfun)? I wrote some code in the 2016a prerelease which required a lot of computations involving multiplying row and column vectors with arrays of varying dimensions, and was somehow able to do this in the prerelease with just element wise notation (I thought maybe this was a now built in for arrays of size m by 1, or 1 by n??). I'm now having to revert back to using bsxfun() for array multiply, plus, etc. Did I miss something in the documentation or am I (hopefully not) going crazy?
Cheers,
  3 个评论
John D'Errico
John D'Errico 2016-3-16
Yes. If you did write code that operated differently/successfully in 2016a(pre) please show an example or two.
T
T 2016-3-16
Simplest example:
>> ones(1,4).*ones(20,1)
2016a prerelease:
ans =
% 20 by 4 array of ones
2016a full:
% Gives error
And for reference, an example line of my code that had to be changed from pre to work in full.
2016a prerelease:
V_R = sqrt((Vrp_a+vi).^2+(Vaz_perp + omega_r_mid - ui).^2);
2016a full:
(had to modify slightly to work)
V_R = sqrt((Vrp_a+vi).^2+(bsxfun(@plus,Vaz_perp,bsxfun(@times,omega_r_mid,ones(1,azm)))-ui).^2);
(Vector sum of velocities along rotor blade section, omega_r_mid is a column vector, vi and ui are arrays that have the same height as omega_r_mid but change in length depending on other user input parameters, the rest of the variables are 1x1's).
Thanks for the quick responses!

请先登录,再进行评论。

采纳的回答

Steve Eddins
Steve Eddins 2016-3-16
No, you are not going crazy. We were trying some new behavior in the prerelease for some operators and functions. Testing revealed some issues we needed to address, so we pulled the change from the final R2016a release. The prerelease documentation did not include information about the change.
  2 个评论
T
T 2016-3-16
Thanks Steve. Any chance that some of these changes will be included in future releases or there being some sort of toggle to enable this behavior for simple operations? Avoiding using the bsxfun() (shown in the example I pasted in the comments) was really helpful.
Steve Eddins
Steve Eddins 2016-3-16
I like your code without the bsxfun calls a lot better. Stay tuned.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by