Search code examples
matlabstructureglobalsimulinkbus

Share large structures among several Function-Blocks


In my matlab-base-workspace I have a big structure, that contains a lot of data, that is important for my simulation. Now to access this data in simulink, I though it would be possible to declare the structure as global, and access it this way in serveral matlab-function-blocks in simulink. It is important, that everything does also works with code generation. I do know that I also have to initialize my structure somewhere in simulink, so I use the data-store-memory-block, where I use a Bus as datatype, corresponding to my structure. In the data-store-memory-block I also initialize my structure with 'struct('data',struct('sub,...' and so on. Now there is a problem:

This does indeed work, but my structure is too big, and so, the string in the initialize-field in the data-store-memory-block gets to long, and can not get evaluated ("Invalid Entry").

So basically, how can I initialze a big structure, that has a corresponding bus-object, can be shared among several simulink-function-blocks and is also compatible with code generation? Thanks!


Solution

  • Does work now. I simply tried a newer version of Matlab (2018b) and this is no issue anymore.