Assigning elements or an array within a Bus

6 views (last 30 days)
Paul Johnson
Paul Johnson on 18 Nov 2021
Edited: Paul Johnson on 18 Nov 2021
Hi,
I have a Bus that is a structure of Buses where some of them are simple types with large dimensions.
E.G
"BusType1" = A bus structure with elements A,B and C of type Boolean,Boolean and Int32 respectively.
"Bus.Bus_Child_1" is of type "BusType1" with 30 Dimensions
Within my model I would like to assign some of the elelements of in Bus_Child_1.
I have currently been performing this using a matlab function within the model. Similar to this:
function Bus = fcn(DefaultBusValues,AInput,BInput,CInput)
Bus = DefaultBusValues;
for idx = 1:length(AInput)
Bus.Bus_Child_1(idx).A = Boolean(AInput(idx));
Bus.Bus_Child_1(idx).B = Boolean(AInput(idx));
Bus.Bus_Child_1(idx).C = Int32(AInput(idx));
end
Using this Implementation I'm finding that the performance of my model suffers.
Is there a different implementation method that would perform better?
Thanks!

Answers (0)

Categories

Find more on Interactive Model Editing in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!