Recognizing properties, methods and function names in Matlab code.

조회 수: 2 (최근 30일)
SK
SK 2022년 4월 16일
댓글: SK 2022년 4월 16일
I'm writing a global naming convention change utility for Matlab code. To this end, I would like to know the answers to the following:
In correctly written Matlab and excluding dynamic access:
1. Given a property name outside of its declaration in class, will it always be preceded by a dot?
2. Given a method name outside of its declaration in class, will it always be preceded by a dot?
3. Given a method name outside of its declaration in class, will it always be followed by zero or more whitespaces and an open parenthesis OR followed by an @ symbol?
4. Given a standalone function name will it always, in correctly (non-deprecated) written code, be followed by zero or more whitespaces and an open parenthesis OR be preceded by an @ symbol?
Thank you for any help.

답변 (1개)

Bruno Luong
Bruno Luong 2022년 4월 16일
None of that is true. Some counter examples:
  1. set(obj, 'property', value)
  2. mymeth(obj, ...)
  3. obj.mymeth % no argument
  4. feval('myfun', arg1)
  댓글 수: 8
SK
SK 2022년 4월 16일
Of course, how stupid of me. Yes that certainly would be an issue.
SK
SK 2022년 4월 16일
I will also assume that the root folder tree is closed (that is all references to names inside the folder tree are defined within the tree and there are no references to names from outside the tree). This would make it simpler.

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

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by