필터 지우기
필터 지우기

My code is in drop box. it works on my laptop but doesn't work on PC

조회 수: 1 (최근 30일)
Hello,
I have a code in drop box. It works on my laptop but doesn't work on PC (Shows Matrix Dimensions must agree). Could you guide me what the problem is? MATLAB version in my PC is 2016 and in my laptopa is 2016b.

채택된 답변

Star Strider
Star Strider 2017년 4월 12일
My guess (since we don’t have your code) is that your code uses ‘implicit expansion’ that was introduced in R2016b. You need to replace the ‘implicit expansion’ calculations that are throwing the error with bsxfun calls. That way, they will be compatible with prior MATLAB versions.
  댓글 수: 3
Star Strider
Star Strider 2017년 4월 12일
My pleasure.
The repmat function is likely not causing the problem you are seeing.
The problem is most likely ‘implicit expansion’. In the Release Notes (link) for R2016b, see the section in Mathematics on:
  • Implicit Expansion: Apply element-wise operations and functions to arrays with automatic expansion of dimensions of length 1
See especially the Compatibility Considerations section. I cannot link directly to this part of the documentation, so you will have to scroll down and read about it.
If you replace the calculations where you use ‘implicit expansion’ with appropriate calls to bsxfun (link), your code will be compatible with both versions of MATLAB.
Walter Roberson
Walter Roberson 2017년 4월 12일
To make this more concrete:
You probably add a row vector to a column vector, which is something that is defined for R2016b or later but not in earlier code. Or possibly you add (or subtract) a vector with a matrix, such as if you had
A - mean(A)
For a 2D array, A, mean(A) would be a row vector, and a 2D vector minus a row vector is not defined before R2016b, and would have to be replaced with
bsxfun(@minus, A, mean(A))

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 EEG/MEG/ECoG에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by