필터 지우기
필터 지우기

Add class to Scripts

조회 수: 30 (최근 30일)
Vasco
Vasco 2020년 6월 3일
댓글: Walter Roberson 2020년 6월 3일
Since R2016B it is possible to create a local function inside a script, reducing the burden of many m files. This is described here: https://nl.mathworks.com/help/matlab/matlab_prog/local-functions-in-scripts.html
How can the same be done with classes? I want to overload a method of an existing class, and plan to use it only in a certain script.
When I try this, matlab R2018b complains about: Illegal use of reserved keyword "classdef".

답변 (1개)

Walter Roberson
Walter Roberson 2020년 6월 3일
That cannot be done. Class methods can only be defined inside of .m files whose first executable word is classdef
  댓글 수: 2
Vasco
Vasco 2020년 6월 3일
Are there plans to include this feature in any future versions of matlab, like is done for functions? The same motivation as for functions applies.
Walter Roberson
Walter Roberson 2020년 6월 3일
I have not been told whether there are plans for this. I would not expect it to happen.

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

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by