How to use Simulink.Bus.createMATLABStruct function with Simulink Data Dictionaries
Ältere Kommentare anzeigen
I have a Simulink Constant Block where the value is
Simulink.Bus.createMATLABStruct('myBus');
in order to create a Simple test-harness.
If the bus-object for 'myBus' is in the base-workspace then it works. However, if the bus-object is defined (solely) in a linked data-dictionary then it does not.
Antworten (4)
you can also try next code:
dd_name=get_param('Model Name','DataDictionary');
scope = Simulink.data.DataDictionary(dd_name);
pStruct=[];
dims=[1,1];
obj='BUS_NAME';
BUS_NAME_MATLABStruct = Simulink.Bus.createMATLABStruct(obj, pStruct, dims, scope);
simon pierce
am 2 Jul. 2018
Robert Simpson
am 11 Jun. 2018
0 Stimmen
I also have this issue. Automatically created test harnesses try to set initial condition of ZOH blocks by running Simulink.Bus.createMATLABStruct('.....'); in the mask of the signal spec block. But this fails.
Sebastian
am 10 Okt. 2023
0 Stimmen
If you have nested buses in your data dictionary it gets even more complicated, because you have to load all referenced buses to the base workspace as well.
Is there an easier way available in the latest releases?
Kategorien
Mehr zu Prepare Model Inputs and Outputs finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!