I have a Struct variable being passed into my Matlab Function inside Simulink, ie:
MyStruct.Field1.(some more fields)
MyStruct.Field2.(some more fields)
MyStruct.FieldN.(some more fields)
Each field has a different structure to it so I had created a Bus to allow Simulink to deal with the data and make each field explicitly since Simulink does not allow a Struct array with different field types, but that's besides the point.
My problem is that inside of my Matlab Embedded Function I want to be able to iterate through my Fields since the number of fields for my models can change and I will be calling a subroutine for each one. Currently, I have to explicitly rewrite my embedded function, ie:
Ideally, I wanted to do something like this, but it doesn't work because code generation doesn't allow for it.
numFields = length(fieldnames(MyStruct);
for i = 1:numFields
Problem is that 'fieldnames' and 'sprintf' is not supported for code generation. So I'm stuck looking for another solution.