Variable highlighting isn't working

조회 수: 9 (최근 30일)
Trevor Bruns
Trevor Bruns 2019년 9월 8일
편집: per isakson 2019년 9월 8일
I can't seem to get variables to be highlighted in the editor. If I understand correctly, this should be controlled by the checkbox in: Preferences > Colors > Programming Tools > Variables and function colors > Variables with shared scope. I've tried all combinations of checking, unchecking, changing the color, restarting Matlab between changes, etc. and nothing works. My function variables remain the same default text color (i.e. black if background is white, white if background is black).
I'm running 2019a on Windows 10.
  댓글 수: 1
Rik
Rik 2019년 9월 8일
So when you click on a variable, that specific variable doesn't change color? Or do you want all variables to change color?

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

채택된 답변

Stephen23
Stephen23 2019년 9월 8일
편집: Stephen23 2019년 9월 8일
"I can't seem to get variables to be highlighted in the editor."
MATLAB automatically highlights all reachable instances of a variable when you click on it:
I suspect that you do not actually mean highlighting (which refers to a rectangular background of a different color to the normal background) but to changing the text color: the MATLAB IDE does not have an option to select a different text color just for variables.
"Variables with shared scope" does NOT refer to ALL variables in a function. It refers only to variables that are common across multiple workspaces, e.g. those used in a nested function and also in the main/parent function.
That option works correctly on my MATLAB version (R2015b), as I show below:
Selected:
Capture1.PNG
Unselected:
Capture2.PNG
You can see how the shared variable z is colored when I select that option, and not colored when the option is not selected.
  댓글 수: 1
Trevor Bruns
Trevor Bruns 2019년 9월 8일
Ah! I didn't fully understand what that meant. Makes sense now, thanks!

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

추가 답변 (1개)

per isakson
per isakson 2019년 9월 8일
편집: per isakson 2019년 9월 8일
I guess the problem is with the meaning of "Variables with shared scope". See Check Variable Scope in Editor
The gui you refer to shows this sample (R2018b)
Type the text of this sample in the editor. Aren't the variables hightlighted as in this image?
  댓글 수: 1
Trevor Bruns
Trevor Bruns 2019년 9월 8일
Yep, that was my confusion. Thanks!

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

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by