Alternative to Save and Load

10 次查看(过去 30 天)
Lorenz Fehn
Lorenz Fehn 2020-9-15
Hey guys I have this problem:
I have two different MATLAB Sessions, which are exchanging data. The first session saves a variable 'count' at a random moment I don't know before, and the second session continuously loads this exact variable (it exists before the first session has uploaded it, but hasn't reached the right value yet). So in the end this happens: while one session continuously refreshes 'count' by loading it over and over again, the other session uploads it at a random time, and my suggestion is that in the very short moment of session one uploading it, it isn't readable for session two, which is why I get an error. (error messages vary between 'not an ASCII' and 'file is corrupt'.
I don't get this error every time, but in need 'count' to be exchanges way too often to accept it crashing once in a while.
I should also say: I am using a Remote Control version of Matlab 2018, which is why I can't exchange any data on my local computer.
Thanks for any help!!

回答(1 个)

Ameer Hamza
Ameer Hamza 2020-9-16
Try this method: https://www.mathworks.com/help/matlab/import_export/share-memory-between-applications.html. Otherwise, try using a try-catch block to ignore the cases when the file cannot be loaded in session 2.

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by