Converts a MATLAB structure, s
, to a Simulink Bus Object with name,
bus_name
, in the base workspace or as an output. This is useful, for
instance, when a Simulink Constant block contains a MATLAB structure, and
this structure is passed into a MATLAB block. A bus can be created for
the structure, and then the block output can be set to the generated bus
type.
bus = struct2bus(s)
struct2bus(s, bus_name)
This function is used by the *kf
engine when it creates Simulink models
for filters which may have struct inputs.
The generated buses will have only real signals and constant sampling times. It will take the data type from each field, but is not meant to handle every possible data type that MATLAB's very flexible structures can store, handling instead only basic types like 'double' and 'uint8'.
This function is based on a function by the same name by The MathWorks, as provided https://www.mathworks.com/matlabcentral/answers/uploaded_files/2051/struct2bus.m.
s | MATLAB structure containing basic numerical types |
---|---|
bus_name | Name for bus object (only used when there are no outputs) |
(none) |
|
---|---|
bus | The constructed bus object |
constants.F_km1 = eye(2);
constants.H_k = [1 0];
struct2bus(constants, 'bus_filter_constants');
my_bus = struct2bus(constants); % same as above, but stored in my_bus.
*kf
v1.0.3