Custom defined data class not recognized
8 views (last 30 days)
Show older comments
Christopher Fromme
on 17 Nov 2021
Commented: Christopher Fromme
on 17 Nov 2021
Hello,
I've created the following folder structure:
D:\_rep\library\MATLAB_packages\+fwpck\@GlobalParam\
In that folder I created the file 'GlobalParam.m' with the following content:
classdef GlobalParam < Simulink.Parameter
%--------------------------------------------------------------------------
properties(PropertyType = 'double scalar')
ConversionFactor = 1;
end
%--------------------------------------------------------------------------
methods
function obj = GlobalParam(type, value, convFact, min, max)
% GlobalParam Class constructor
% call superclass constructor
obj@Simulink.Parameter();
% set properties
obj.DataType = type;
obj.Value = value;
obj.ConversionFactor = convFact;
obj.Min = min;
obj.Max = max;
end
end
end % classdef
I added the path 'D:\_rep\library\MATLAB_packages\' and tried the following code line:
>> globalParam1 = GlobalParam('single', 145.45, 0.34, 100, 200);
This results in the error
Unrecognized function or variable 'GlobalParam'.
What am I missing?
Any help would be highly appreciated. :)
Thanks
Christopher
0 Comments
Accepted Answer
Steven Lord
on 17 Nov 2021
That class is part of the fwpck package. You will need to call it using the package name or import the package.
y = fwpck.GlobalParam('single', 145.45, 0.34, 100, 200);
More Answers (0)
See Also
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!