Hello, I am in need of help on how to display real time accelerometer data coming in from the ez430 in my own GUI using MATLAB.
Using this code I have been able to get the data coming in to MATLAB and numerical values can be displayed in the command window, but I am having difficulty in displaying the data into a static text box.
Can someone please suggest how to do this?
I have the values coming in as X, Y and Z.
I was hoping that using set(handles.b_x,'String', X); would display the X value into text box b_x but it doesn't.
Here is the code:
% --- Executes on button press in ez_button.
function ez_button_Callback(hObject, eventdata, handles)
% hObject handle to ez_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% SETUP of USB AccessPoint
s = serial(port_number);
s.InputBufferSize = 1024;
s.ReadAsyncMode='continuous'; % !!!!!!! important
if s.Status(1:4)=='open' disp('Closing formerly opened port');fclose(s);end;
s.ErrorFcn=@mycallback; % not important - you can specify your own error callback
% Port open
fopen(s); % you can use exceptions, but better soluton is break on error
% when there is still problem after first run - try RESTART MATLAB!!!
%get(s) % display port status and settings
% Header of FRAMEs settings
StartAccessPoint=[255, 7,3]; % numbers taken from ez430 source code
% Start AccessPoint
% Main read cycle
x_value = X;
%these are the acc values
% i was hoping this would display the X value in text box b_x but it does not
% using disp(X); i can display in command window, but i want in my own GUI.
% stop on idle
if ((X==0) & (Y==0) & (Z==0)) stop_flag=stop_flag+1;end;
if ((X~=0) | (Y~=0) | (Z~=0)) stop_flag=0;end;
% disp('RS232 dropout');
disp(['Sync mode off / communications lost.']);