matrix variable saved with data store blocks

MathWorks hi everyone, my problem is very simple, i want to generate several matrix [nxm] with a matlab embedded function that must to be accesible by another functions during simulation. For this, i think use a data store blocks, but i cant resolve with the matlab help in the example, so any idea will be well accepted, thx

 Accepted Answer

Here is some documentation on Using Global Data with the MATLAB Function Block. (Note: Embedded MATLAB Function blocks are now simply called MATLAB Function blocks, starting in R2011a)

2 Comments

thx for your time,
i was read this help topic, but i read again and found that the "Limitations of Using Shared Data in MATLAB Function Blocks" says doesn't work with variable sized data, that is to say the block does not help me.
So, are my conclusion corrects? any idea for this problem?
Yes, I believe Data Store Memory blocks do not support variable-size data. Does the size of your data change during simulation? If yes, do you know what the maximum size of your data could be? One option would be to create a variable of maximum size and use one of two methods:
1. Use some value X - maybe NaN or a number that is outside the expected data range. (ie. if max size is 3x3, and at a given time-step your variable is 1x1, you could use something like: [1 X X; X X X] to represent your variable).
2. Use another Data Store Memory to store the dimensions of your data, and in Embedded MATLAB block, only read data within that size.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!