Using read write data meory block using indirect addressing - SIMULINK
1 view (last 30 days)
Show older comments
I need a storage array data memory - block - effectively circular buffer -- write 1 entry at a time -- but I have to continually calculate the mean
Currently, I have set up a data memory block - initialized with 1: 1024 and have hardcoded a read memory block accessing all 1024 -- which I iuse to calculate a mean - No real issue (I think)
For simplisticity -- I have a constand writing into a write data memory block
I can adjust the write data memory block to write into any hard coded element of the data memory block e.g. A(1) A(50) etc
but I want to use the data memory block as a circular arry -- so I want to use A(posn) where posn is a variable that is changing over time
I can't find how to make this work any where on the web -- just how to write one element into the block
it is so simplistic that I must be missing something obvious
Trying to avoid globals - but if thats a solution -- not getting that right either :-(
0 Comments
Answers (1)
Fangjun Jiang
on 21 Feb 2024
2 Comments
Fangjun Jiang
on 26 Feb 2024
If you are open to use the MATLAB Function block, I would agree that is the best approach for your task.
See Also
Categories
Find more on Simulink Coder 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!