Search code examples
matlabdynamicsimulinkbus

MATLAB/SIMULINK dynamic bus conversion with embedded Matlab function


I'm working on automated model building. In some cases I have do convert a bus into another bus (the structure is the same, but there can be variants in the names). It works for a static model where I can change the datatype of the inputs and outputs, but I didn't find any way to do this from the command line or directly in an embedded MATLAB function.

Does anybody know a way to do this?


Solution

  • mfb = find(sfroot, '-isa', 'Stateflow.EMChart', 'Name', 'test'); 
    out = get(mfb, 'Outputs'); 
    out.set('DataType', ['Bus: ' component_source.test]);