Variable highlighting sometimes doesn't work (Editor)

With some variables, clicking on them in the Editor does not highlight other occurrences of that same variable within the current script, as would be expected.
Not sure why that is the case, since those variables are no different from those for which highlighting works normally; and there are no syntax errors in my script. Any ideas? Using R2016a.

댓글 수: 3

The only time I have really observed this to happen is when I have syntax errors or am in the middle of writing a function or line of code (which is basically the same thing since the half-finished line is a syntax error).
That's what I suspected as well, but as I said I have no unfinished code or syntax errors!..
Actually, I think it was caused by a return command I had in my script somewhere, that made some lines non-reachable - so still in the same vein. Thanks again!

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

 채택된 답변

z8080
z8080 2017년 3월 9일

1 개 추천

caused by a return command I had in my script somewhere, that made some lines non-reachable

추가 답변 (1개)

An
An 2023년 12월 25일
편집: An 2023년 12월 25일

0 개 추천

It seems that only variables defined locally are highlighted. Added a "global varname" at the beginning (varname the variable that was not being hightlighted) and it started being highlighted.
Hope this helps (me) or anyone else.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2017년 3월 8일

편집:

An
2023년 12월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by