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

1 visualizzazione (ultimi 30 giorni)
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 Commento
Mehmed Saad
Mehmed Saad il 22 Apr 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});

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by