i need to have a variable which i can access into and assign to during the simulation in simulink. any suggestions please?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Nishant Gupta
2020-5-26
You can use 'To workspace' block, it might help you. Refer to the following link for its documentation:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!