フィルターのクリア

How to execute timer functions in MATLAB GUI in parallel?

11 ビュー (過去 30 日間)
RZM
RZM 2018 年 8 月 15 日
コメント済み: Geoff Hayes 2022 年 7 月 1 日
I have designed a GUI using MATLAB GUIDE. I need to execute two timer functions in parallel. Let's say we have a timer and its function defined inside the GUI as follows:
handles.data_acq_tmr = timer(...
'ExecutionMode', 'fixedRate', ...
'Period', 0.2, ...
'Busymode','queue',...
'TimerFcn', {@data_read, hObject});
function data_read(~,~,hObject,~)
handles = guidata(hObject);
% do some processing here
guidata(hObject,handles);
and the second timer as follows:
handles.dataproc_tmr = timer(...
'ExecutionMode', 'singleShot', ...
'StartDelay', 0,...
'Busymode','queue',...
'TimerFcn', {@data_proc, hObject});
function data_proc(~,~,hObject,~)
handles = guidata(hObject);
% do some other processing here
guidata(hObject,handles);
Is there any way to do it in MATLAB for instance using Parallel Computing Toolbox?
  6 件のコメント
Geoff Hayes
Geoff Hayes 2018 年 8 月 17 日
RZM - what are the callbacks for your timers doing? Are they performing complex and/or expensive operations?
RZM
RZM 2018 年 8 月 17 日
編集済み: RZM 2018 年 8 月 17 日
One reads the data transferred from another computer, and the other one does some processing on a sequence of recorded data including filtering, and some expensive operations on multiple variables. There are some other timers to control the presentation of some visual stimuli on the screen.

サインインしてコメントする。

回答 (1 件)

Sean de Wolski
Sean de Wolski 2018 年 8 月 15 日
Use parfeval in the parallel computing toolbox to asynchronously run the computationally expensive algorithmic (not gui updates etc.) part in the background. Use a timer to poll the job for when its state is "finished" for when it's done to update the user interface.
  5 件のコメント
RZM
RZM 2018 年 8 月 17 日
Thank you Sean, I still cannot figure out what to do.
Geoff Hayes
Geoff Hayes 2022 年 7 月 1 日
@Claudia-Elena Ilie's answer moved here.
Hello, @RZM,
By any chance, you understood how to rezolve your problem? I have something similar :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by