我正在研究一个在不同模式下配置的 simulink 模型,这些模式会根据所选采样率滤波器组延迟等内容更改模型参数...
我虽然在 a 上设置所有参数ParameterStruct
,然后为每种模式加载正确的参数结构。
这种类型很好地映射到具有 Dependent 属性的类,因为只有几个输入生成了很多模型参数。
但是,当我尝试从不尊重可见性生成一个struct
时:class
classdef SquareArea
properties
Width
Height
end
properties (Access =private)
Hidden
end
properties (Dependent)
Area
end
methods
function a = get.Area(obj)
a = obj.Width * obj.Height;
end
end
end
>> x=SquareArea x = SquareArea with properties: Width: [] Height: [] Area: [] >> struct(x) Warning: Calling STRUCT on an object prevents the object from hiding its implementation details and should thus be avoided. Use DISP or DISPLAY to see the visible public details of an object. See 'help struct' for more information. ans = Width: [] Height: [] Hidden: [] Area: []
这是不可接受的,因为之后我需要将结构导出到 C,以便能够从生成的代码中动态设置模式。