Implicit matrix expansion correction

1 次查看(过去 30 天)
I have the following line of code (running in Matlab2016b), but which shows up with a "matrix dimensions must agree" error in Matlab2015a. How would I correct it? Thank you!
a=reshape(a(a ~= b(:,2)'),[],c);

回答(1 个)

Guillaume
Guillaume 2017-6-20
It would have been helpful if you'd provided more details such as the size of a, b and c. Most likely,
a = reshape(a(bsxfun(@ne, a, b(:, 2)'), [], c);
would solve the problem. If not, provide more details.
While you're at it rename these extremely meaningless variable names to something a lot more meaningful.

类别

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