proper use of DataQueue and PollableDataQueue inside of App Designer class?

7 ビュー (過去 30 日間)
dleal
dleal 2022 年 5 月 25 日
コメント済み: dleal 2022 年 5 月 25 日
Hi all,
I am aware there are some limitations for the usage of Parallel Computing Toolbox inside of App Designer. How could I set up a method that uses a dataqueue and/or a pollable dataqueue to send data back to the client? I keep getting the following warning:
Warning: Unable to save App Designer app object. Save not supported for matlab.apps.AppBase objects.
I would like to do something similar to the code below
classdef testClass < matlab.apps.AppBase
properties
q;
future1;
end
methods
function app = testClass()
app.q = parallel.pool.DataQueue;
app.q.afterEach(@(x) disp(x));
app.future1 = parfeval(@app.gen,0,app.q);
end
end
methods(Static)
function gen(q)
iter = 1;
while iter < 10
send(q, randn(1));
iter = iter + 1;
pause(0.1);
end
end
end
end

採用された回答

Edric Ellis
Edric Ellis 2022 年 5 月 25 日
In this case, the problem is not with your DataQueue - it's actually with the function handle you're passing in to parfeval. The syntax @app.gen actually binds the value of app into the function_handle - but you don't need that. So, in this case, you can fix this simply by naming the Static method like so:
app.future1 = parfeval(@testClass.gen,0,app.q);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by