Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to stop the engine from incorrectly interpreting my code

조회 수: 1 (최근 30일)
Chris Wolf
Chris Wolf 2017년 8월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
I switched from 2014b to 2016b, and I've noticed some odd behavior in the newer version. You can try to do something that is mathematically nonsensical, and the engine will find a way to change your request into something tractable. For example, you can add a row vector to a column vector. The engine automatically applied 'meshgrid' to your vectors and then does the addition.
(1:10) + (1:10)'
This is intractable and nonsense. Older matlab versions would throw an error. As they should, right?
This led to some long debugging. Instead of throwing an error, which would point me to my coding error, it happily came up with a nonsense answer and continued the program execution.
Is there a way to turn off this 'user interpreting' feature? I'd much prefer matlab just executes the code I write, and throws an error if I do something wrong.
  댓글 수: 1
Stephen23
Stephen23 2017년 8월 19일
+1 "This is intractable and nonsense"

답변 (1개)

Walter Roberson
Walter Roberson 2017년 8월 18일
There is no way to turn off this feature, which is new in R2016b. Binary operations between vectors now mostly operate as if bsxfun() had been used.
The feature can be useful when deliberately used, but it can also make debugging difficult.
  댓글 수: 2
Chris Wolf
Chris Wolf 2017년 8월 18일
Thanks for a quick answer. Bummer you can't turn it off.

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by