Having issue in plotting live data of three channels in a single UI Axes
Mostrar comentarios más antiguos
I am having issue in ploting real time data in UI Axes of 3 channels. I am able to plot the data of one channel but when i try for two or three channels it show an error or plots only one channel and the stops in between .Can anyone help me out where i am going wrong or at what thing i am missing to add in my code. The two values i wanna show are trip and alarm line which i want to fetch from app. Plz any one can guide me with the code.
i=1;
ii=1;
while strcmp(app.Switch.Value, 'On')
clear m
m = modbus('serialrtu','COM5',BaudRate=9600);
m.Timeout = 0.275;
% Rack 1 Slot 1 Module 1
serverId1 = 2;
tripM1A = read(m,"holdingregs",1,1,serverId1,"uint16");
alarmM1A = read(m,"holdingregs",6,1,serverId1,"uint16");
fullscaleM1A = read(m,"holdingregs",11,1,serverId1,"uint16");
processM1A = read(m,"holdingregs",44,1,serverId1,"uint16");
% Data of channels
app.ALARM.Value = alarmM1A;
app.TRIP.Value = tripM1A;
app.CHA.Value= processM1A;
% To plot data in UI Axes
data1A(i)=app.CHA.Value;
% data1T(ii)= app.TRIP.Value;
if i<=60
plot(app.UIAxes,data1A,'LineWidth',1.5);
% plot(app.UIAxes,data1T,'LineWidth',1.5);
else
plot(app.UIAxes,data1A(end-60:end),'LineWidth',1.5);
end
title(app.UIAxes,'Live Trend Module 2 Channel A');
xlabel(app.UIAxes,'Time in seconds','Color','k');
ylabel(app.UIAxes,'Amplitude','Color','k')
ylim(app.UIAxes,[0 fullscaleM1A]);
grid(app.UIAxes, "on");
pause(0.1)
i= i+1;
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!