Is anyone able to provide an update on the options available for providing values in the custom data tip based on values from other lines on the plot that can be updated in real time? I have been working on this and still I am unable to find a solution
Adding Custom Data Tips to Plot Running in Real-Time
7 次查看(过去 30 天)
显示 更早的评论
I am working on designing an app that plots seven different lines in real time to indicate how certain values are trending over time. I am trying to create custom data tips for each line that is plotted to display the values of all the other lines at that time as well as a few extra values. When I create the custom data tips when the plot is originally created all the custom data tip rows don't show any values, just labels. I tried creating a function to call the custom data tip functions again, so as to update with the latest values of the variables I am trying to include in the data tips. When I do this, I get an error saying "Value must be compatible with the data source". Is there any way to update the custom data tips while plotting in real time? The functions I am using are shown below.
function CreateDataTips(app)
%Discards Line Data Tips
app.discardsplot.DataTipTemplate.DataTipRows(1).Label = 'Date-Time';
app.discardsplot.DataTipTemplate.DataTipRows(2).Label = 'Packet Discards';
app.discardsplot.DataTipTemplate.DataTipRows(3) = dataTipTextRow('Packet Retries',app.Retries_all);
app.discardsplot.DataTipTemplate.DataTipRows(4) = dataTipTextRow('Packet Fails',app.Fails_all);
app.discardsplot.DataTipTemplate.DataTipRows(5) = dataTipTextRow('Bits Recieved',app.Recieved_all);
app.discardsplot.DataTipTemplate.DataTipRows(6) = dataTipTextRow('Bits Sent',app.Sent_all);
app.discardsplot.DataTipTemplate.DataTipRows(7) = dataTipTextRow('RSSI',app.RSSI_all);
app.discardsplot.DataTipTemplate.DataTipRows(8) = dataTipTextRow('SNR',app.SNR_all);
app.discardsplot.DataTipTemplate.DataTipRows(9) = dataTipTextRow('TX Rate',app.Rate_all);
%Retries Line Data Tips
%.... Same for other 6 lines
end
function UpdateDataTips(app)
%Discards Line Data Tips
app.discardsplot.DataTipTemplate.DataTipRows(3).Value = app.Retries_all;
app.discardsplot.DataTipTemplate.DataTipRows(4).Value = app.Fails_all;
app.discardsplot.DataTipTemplate.DataTipRows(5).Value = app.Recieved_all;
app.discardsplot.DataTipTemplate.DataTipRows(6).Value = app.Sent_all;
app.discardsplot.DataTipTemplate.DataTipRows(7).Value = app.RSSI_all;
app.discardsplot.DataTipTemplate.DataTipRows(8).Value = app.SNR_all;
app.discardsplot.DataTipTemplate.DataTipRows(9).Value = app.Rate_all;
%Retries Line Data Tips
%.... Same for other 6 lines
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!