How to display a real time graph in the Matlab GUI from simulink block

Click For Summary
SUMMARY

This discussion focuses on displaying real-time ECG signals in a MATLAB GUI using Simulink blocks. The user is attempting to utilize the 'Scope' block in Simulink to visualize data on GUI axes but encounters issues with the provided callback function. The code snippet includes commands to start and stop the simulation, as well as to update the GUI axes, but the user reports it does not function as intended. Key areas for troubleshooting include the input configuration for the Simulink block and ensuring proper integration with the GUI components.

PREREQUISITES
  • Familiarity with MATLAB GUI development
  • Understanding of Simulink block parameters and commands
  • Knowledge of MATLAB callback functions
  • Experience with real-time data visualization techniques
NEXT STEPS
  • Review MATLAB GUI callback function implementation
  • Learn about Simulink block input configurations
  • Explore real-time data plotting in MATLAB using 'plot' and 'drawnow'
  • Investigate the use of 'Simulink Real-Time' for enhanced performance
USEFUL FOR

This discussion is beneficial for MATLAB developers, engineers working with real-time data visualization, and anyone integrating Simulink with MATLAB GUIs for signal processing applications.

satinysol
Messages
14
Reaction score
0
I want to display a real time signal from ECG
I use simulink block -scope and want it to be display in gui axes
This is a code from some other guy

function Command1_Callback(hObject, eventdata, handles)
button_state = get(hObject,'Value');
if strcmp(get(handles.Command1,'String'),'Start Recording') && (button_state == get(hObject,'Max'))
% toggle button is depressed
set(handles.Command1,'Enable','on');
set(hObject,'String','Stop Recording');
%open_system('simu');
set_param('simu','SimulationCommand','Start');
axes(handles.axes1);
set(handles.axes1,'XMinorTick','on');
grid on;
elseif strcmp(get(handles.Command1,'String'),'Stop Recording') && (button_state == get(hObject,'Max'))
set(handles.Command1,'Enable','on');
set(hObject,'String','Start Recording');
set_param('simu','SimulationCommand','Stop');
cla(handles.axes1,'reset');
guidata(hObject, handles); %updates the handles
end

But it doesn't work for my GUI , i don't know why ,can anyone tell which code is the input for simulink block and if there is any mistake please mention it.Thanks
 

Attachments

  • gUSBampdemo.png
    gUSBampdemo.png
    36.1 KB · Views: 1,209
Last edited:
Physics news on Phys.org
Can anyone help me ?
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
Replies
1
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
12K