how to highlighting object property

조회 수: 1 (최근 30일)
Franklee09
Franklee09 2019년 3월 22일
댓글: Anton Lausbua 2021년 12월 1일
Is there any way to highlight properties in class definition. In the example below, if I select property1, the rest of the occurance of property 1 won't be highlighted. This could be useful when I have a very long class definition.
classdef TestObj < handle
properties
property1=100;
property2;
end
methods
function self = TestObj(value1)
self.property1=value1;
end
function fun2(self, value2)
self.property2=value2;
end
end
end
  댓글 수: 3
per isakson
per isakson 2021년 5월 12일
Didn't the answer by @Anant Upadhyay help you?
Anton Lausbua
Anton Lausbua 2021년 12월 1일
@per isakson the answer also did not help me either. The highlighting does work only for local variables not for class properties. Is there another option to turn this on?

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

답변 (1개)

Anant Upadhyay
Anant Upadhyay 2019년 3월 27일
Hi Yunarui,
According to my understanding, the requirement is that if a certain property of a class is selected, then the rest of the definitions of that property should be highlighted. MATLAB supports this feature for all version from MATLAB R2010b release.
The highlighting option can be set using following steps:
  • Select “preferences” in the “Home” Tab of your MATLAB editor.
  • Under “MATLAB” section in “preferences”, select “Colors” -> “Programming Tools”.
  • Check the option “Automatically highlight”, if unchecked.
  • Apply and Save the changes.
The highlighting does have some limitations. It will only find the matching names in code that are in scope. For instance, if you have pass a variable “x” to a subfunction as input argument “x”, the highlighting feature will only highlight the “x”s in either the main function or the subfunction, but not both. And, it won’t recognize that “x” in a comment or string passed to the eval function.

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by