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

1 view (last 30 days)
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 Comment
Mehmed Saad
Mehmed Saad on 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});

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!