When debugging, global websocket feed data doesn't show up

1 vue (au cours des 30 derniers jours)
Martin
Martin le 22 Avr 2020
Commenté : Mehmed Saad le 22 Avr 2020
I use a websocket package named MatlabWebSocket-master to get live data from a website. In a function I am storing that data in a global variable (since I need this live-data everywhere). I am declearing the global variable in all funtions in the system.
In the global variable "feed" I store the client as stucture feed.Client which says: URL: www.....com, Secure: 1, Status, 1, ClientObj: 1x1 MatlabWebSocketSSLClient.
This works fine.
The data I recieve i store like this: evalin('base',['feed.data=',num2str(data{end}),';']);
This usually also works fine.
However sometimes when the whole system is running, the feed.data do not exist, but if I terminate the system, it will show up instant! If it dosnt show up when the system is running I also tried to dubug it, but it still doesnt exist in the variable space (feed.data) in this case. For some reason Matlab can not handle this when the system is running, but as soon as it is terminated its there.
Do I misunderstand global variable, websocket feed or do anyone have an idea?
- Best
  1 commentaire
Mehmed Saad
Mehmed Saad le 22 Avr 2020
The data I recieve i store like this:
evalin('base',['feed.data=',num2str(data{end}),';']);
as you are using global variable it is better to use
global feed
feed.data = num2str(data{end});

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by