Loading and saving huge matrices in Simulink
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am working with a reinforcement learning model in Simulink. For the memory i need to use huge 6D matrices.
Currently I create these matrices in Matlab and load them into my Matlab Function Block in Simulink using the following code:
persistent Q
if isempty(Q)
Q = evalin('base', 'q8');
end
But this is very time consuming, and i have problems saving the matrix back into my Matlab workspace afterwards.
Anyone know of an easier way of working with big matrices in Simulink, that can be loaded and saved?
Examples are greatly appreciated!
Thanks!
0 Kommentare
Antworten (2)
Fangjun Jiang
am 20 Mär. 2019
Can't use .mat file? Try Simulink Data Dictionary.
2 Kommentare
Fangjun Jiang
am 21 Mär. 2019
If your current approach works but slow, the first thing I would try is to save the matraces into a .mat file. Next time, you can use load() instead of evalin() to load the data. I am not sure what you mean by "have problems saving the matrix back into my Matlab workspace afterwards".
The next thing is try SLDD. Go to File->Model Properties->Link to Data Dictionary. Once you finished, just think of the data is loaded from the .sldd file rather than the .mat file.
Emmanouil Tzorakoleftherakis
am 2 Apr. 2019
On a separate note, it looks like you are implementing Q-learning (?). Q-learning uses tables, which do not scale well when your problem is high-dimensional. Maybe switching to a function approximator (e.g. neural network) would help with scaling.
You could also use some of the built-in reinforcement learning algorithms from Reinforcemen Learning Toolbox (e.g. DQN).
Hope this helps.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!