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

조회 수: 1 (최근 30일)
Martin
Martin 2020년 4월 22일
댓글: Mehmed Saad 2020년 4월 22일
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
Mehmed Saad
Mehmed Saad 2020년 4월 22일
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});

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by