필터 지우기
필터 지우기

Implicit matrix expansion correction

조회 수: 1 (최근 30일)
Garima Sharma
Garima Sharma 2017년 6월 20일
편집: Garima Sharma 2017년 6월 20일
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.
  댓글 수: 1
Garima Sharma
Garima Sharma 2017년 6월 20일
편집: Garima Sharma 2017년 6월 20일
Thank you. a is 11x21, b(:,2)' is 1x21, and c is 21.

댓글을 달려면 로그인하십시오.

카테고리

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