Difficulty foor running a class
2 次查看(过去 30 天)
显示 更早的评论
I copied an example as showed in Matlab examples presentation but I get the following message classdef BasicClass ↑ Error: Illegal use of reserved keyword "classdef". Please can you help to run a class example Regards
2 个评论
Walter Roberson
2018-9-23
I speculate that you did not store the classdef in a separate file named after the class to be created.
回答(3 个)
Arun Mathamkode
2018-9-27
As Walter Roberson pointed out, please make sure that you store the classdef in a separate file with the same name as the class name. Also please make sure that you didn't miss any end statements while copying the sample code.
0 个评论
elias BITAR
2018-9-27
编辑:Walter Roberson
2018-9-27
1 个评论
Walter Roberson
2018-9-27
When I store the noted code in MyClass.m then I do not encounter any error in R2018a or R2018b.
Could you attach a copy of the MyClass.m that you are having difficulty with? Not paste but attach: I want to check it for special characters.
elias BITAR
2018-9-30
1 个评论
Walter Roberson
2018-9-30
This new version is not < handle and leads to the editor error that events can only be defined for handle classes.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Construct and Work with Object Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!