问题
I am trying to save functions as variables inside a class so I can reach them in an ordered manner. However, whenever I try to pull any constant from the following class, I get the following error.
%FORMULAS Summary of this class goes here
% Detailed explanation goes here
properties (Constant)
%F.heatCapacityOfLiquid
t = @(z) z *2
end
properties (Constant)
enthalpyChange = @(constants, temperatureIn, temperatureOut)integral(@(temperature)(@(constants, temperature)...
constants(1)...
+ temperature * constants(2)...
+ temperature.^2 * constants(3)...
+ temperature.^3 * constants(4)), 0,10);
heatCapacityOfLiquid = @(constants, temperature) constants(1)...
+ temperature * constants(2)...
+ temperature.^2 * constants(3)...
+ temperature.^3 * constants(4);
end
end
ERROR
>> F.t
Invalid default value for property 'enthalpyChange' in class 'F':
Error: Invalid use of operator.
来源:https://stackoverflow.com/questions/64667602/weird-error-while-using-constant-properties-in-class