- To make sure that MATLAB is loading the class correctly you can run the command in the command window: clear classes
- Note that LLSPP needs to be on your MATLAB search path, or the full path to LLSPP.trial should be specified.
unable to detect a class file to instantiate object
10 ビュー (過去 30 日間)
古いコメントを表示
My file structure is like this
+LLSPP
TMS_2023.m
trial.m
some other files..
in 'trial.m' I have a class definition with a constructor
I am using this in TMS_2023.m
import LLSPP.*
and later trying to instantiate the class
T1 = LLSPP.trial(input1, input2)
but I keep getting this :
Unable to resolve the name 'LLSPP.trial'.
I also tried
T1 = LLSPP.trial.trial(input1, input2)
and
T1 = trial.trial(input1, input2)
and
T1 = trial(input1, input2)
they give the same error
0 件のコメント
回答 (1 件)
Swaraj
2023 年 5 月 29 日
Hi Udaykaran,
I understand that you are not able to access the constructor/class from a script written in the same package. I tried to regenerate the issue. I created the following file structure.
The content of the files are as follows:
File : trial.m
classdef trial
properties
Value;
end
methods
function obj = trial(input1,input2)
obj.Value = input1+input2;
end
end
end
File : TMS_2023.m
import LLSPP.*
LLSPP.trial(10,10);
On running the script “TMS_2023.m”, I was able to access the constructor.
The steps that you followed should work fine. Please try the following steps because of which you might face this error.
If the above steps do not help, please check if you have written the “trial” class properly. Go through the following documentation for reference.
Hope it helps!!.
0 件のコメント
参考
カテゴリ
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!