i am implementing a motion planning algorithm in simulink, I have to collect the successful nodes in a multi dimensional array on the go during simulation and also be able to access the nodes. Currently the only options i came across are
- Initializing, lets say 500x2 array in matlab workspace,then use it as a initial value in data store memory block in simulink. I also declared the data store memory block as global so that i can access it into other function's work space. Every time i want to add a node i read the data store memory value and then write into it by assignment from a matlab function block.
- using persistent variables within the scope of matlab function blocks.
I am still trying to implement the above two ideas. But i am a bit skeptic and i am seeking some experts advice here for better options.
Also, I will be generating vehicle waypoints which will be an array of size nx2 at every iteration which i need to store somewhere accessible during simulation. If not the whole array at least the end point of the waypoint array, i need to be able to use for every next iteration (as the rest of the waypoint array values can be written to matlab workspace which i can access after the simulation is complete).
When i implemented the algorithm in .m script file i used cell array to store the array of waypoints generated at every iteration.