Non-Scalar Structure with Different numels as Parameter in a MATLAB Function Block
Show older comments
I'm implementing a supervisory control function in a SimEvents model using a Matlab Function block wrapped in a Simulink function. It will be called by several custom entity servers to transfer data from a "grand plan" into the attributes of SimEvents entities. The function will manage the plan, recording dispatch status etc. in the same persistent structure that contains the data.
I want to import the initial grand plan from the base workspace as a parameter to the MATLAB function block. I have met most of the constraints for codegen in my code, but I am stuck on the data type constraint, which is only satisfied if all substructures have the same size. My structure is in the form of buckets and packets:
>> numel(bucket(1).orepacket)
ans =
202
>> numel(bucket(2).orepacket)
ans =
204
My baseline assumption is that I will need to pad the orepacket substructure in the workspace so that all buckets have the same number of orepackets. Is there a better way to deal with this? In the Ports & Data Manager, the parameter is tunable but the "variable size" checkbox is greyed out.
Answers (0)
Categories
Find more on Simulink Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!