Running n instances of the same function simultaneously
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have a GUI written in appdesigner with a function that takes a data matrix and uses it to display a "frame", running this in a while loop results in a video being played. This is the code for it:
function PlayButtonPushed(app, event)
% Start conditions
Frame = app.CurrentFrame.Value;
PauseTime = app.TimeBetweenFrames.Value;
NumOfFrames(1) = app.Arena(1).File.NumberOfFrames;
% Main loop
while Frame <= NumOfFrames
DisplayFrame(app, Frame);
drawnow % Update GUI after displaying frame
pause(PauseTime);
% Stop condition
if strcmp(app.StopValue, 'On')
app.StopValue='Off';
break
end
% Update conditions for the next frame
FrameInterval = app.FrameInterval.Value;
Frame = app.CurrentFrame.Value+FrameInterval;
app.CurrentFrame.Value = Frame;
PauseTime = app.TimeBetweenFrames.Value;
app.TimeBetweenFrames.Value = PauseTime;
end
end
So as you can see, app.Arenas is an array and currently it only display the first arena, I would like to expand on it, being able to view two or four(or n, for a generallity) arenas at the same time. I could just loop the "DisplayFrame" function for n but I may want to take in to account the fact that maybe different arenas have a different "total frames" for them, and also, looping it will be a lot slower.
Is there anyway to have this function run multiple times, simultaneously?
Thanks!
0 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Platform and License についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!