audioplayer TimerFcn behavior when busy
이전 댓글 표시
Hello there. Does an audioplayer object have an option to cancel calls of TimerFcn when system busy ?
(Like "BusyAction" for graphic objects or "BusyMode" for timer objects)
댓글 수: 5
Guillaume
2023년 2월 23일
Mario Malic
2023년 2월 23일
Why would system even be busy? Maybe it takes longer time to update plot (because of frequent updates) than the TimerFcn update.
Try increasing the TimerPeriod, you can also check the play and playblocking functions to ensure the proper update.
Guillaume
2023년 2월 24일
Jan
2023년 2월 24일
@Guillaume: Which behaviour do you want to achieve?
Mario Malic
2023년 2월 24일
편집: Mario Malic
2023년 2월 24일
One thing that may be possible, however I am not sure how it would affect the performance of the compiled app. When you use plot, you add line objects, instead you could alter the XData and the YData of the first plotted line object. Example is below
function PlotDataAvailable(src, event)
[data, timestamps, ~] = read(src, src.ScansAvailableFcnCount, "OutputFormat", "Matrix");
persistent init fig ax hPlot;
if isempty(init)
init = true;
fig = figure();
ax = axes(fig);
end
if isempty(hPlot)
hPlot = plot(ax, timestamps, data);
else
hold(ax, "on");
set(hPlot, "XData", [hPlot.XData, timestamps'], "YData", [hPlot.YData, data'])
end
end
Otherwise, you should find a way to debug the compiled application, and figure out why does it happen.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!