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

조회 수: 3 (최근 30일)
T
T 2016년 3월 16일
댓글: Steve Eddins 2016년 3월 16일
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