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

In summary, a user is trying to display a real time signal from ECG using simulink block-scope and wants it to be displayed in a GUI axes. They have found a code from another source but it is not working for their GUI and they are asking for assistance in identifying any mistakes and determining the input for the simulink block.
  • #1
satinysol
14
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,119
Last edited:
Physics news on Phys.org
  • #2
Can anyone help me ?
 

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

1. How do I import data from Simulink into Matlab GUI?

To import data from Simulink into Matlab GUI, you will need to use the "From Workspace" block in your Simulink model. This block allows you to send data to the Matlab workspace, which can then be accessed and displayed in the GUI using the "plot" function.

2. Can I update the graph in real time as the simulation runs?

Yes, it is possible to update the graph in real time as the simulation runs by using the "set_param" and "get_param" functions in Matlab. These functions allow you to access and modify the parameters of Simulink blocks during simulation, so you can continuously update the graph with new data.

3. How can I customize the appearance of the real time graph?

You can customize the appearance of the real time graph by using the "plot" function in Matlab. This function allows you to specify various parameters such as line color, style, and thickness, as well as axis labels and titles.

4. Is it possible to display multiple real time graphs in the Matlab GUI?

Yes, it is possible to display multiple real time graphs in the Matlab GUI by creating multiple axes objects using the "subplot" function. Each axes object can then be linked to a separate Simulink signal and updated in real time.

5. What is the best way to troubleshoot issues with displaying a real time graph in the Matlab GUI?

If you are experiencing issues with displaying a real time graph in the Matlab GUI, the first step would be to check that the Simulink model is running correctly and sending data to the Matlab workspace. You can also use the "disp" function to ensure that the data is being received and processed correctly in the GUI code. If the problem persists, you may need to consult the Matlab documentation or seek assistance from the online community.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
12K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
12K
Back
Top