How to run function without interrupt the process.

8 ビュー (過去 30 日間)
Kantaphon Lertsittiporn
Kantaphon Lertsittiporn 2020 年 7 月 17 日
回答済み: Anirudh Singh 2020 年 7 月 20 日
Hello,
I'm new to this community but I have some question.
I have loop that feel like this in my code. (not exactly like this)
count = 0
while true
a = 1
if a < 10
a = a+1
end
b = a;
count = count +1
if count == obj.Sensor.Count
a = a +10
BotFusion(obj.BotFus,Likelihood); %my function that take long time to compute
count = 0;
end
pause(0.1)
end
I want to run my function without interrupt the process of my code.
How can I run it parallelly or other solution.
Thank you in advance.

回答 (1 件)

Anirudh Singh
Anirudh Singh 2020 年 7 月 20 日
To run the code parallelly you can try using the 'Parfor' loop. but for this, you need to install a parallel computing toolbox.
Please refer the documentation page of the 'parfor' loop : https://www.mathworks.com/help/parallel-computing/parfor.html

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by