필터 지우기
필터 지우기

How can the waitbar and the simulink model work simultaneously?

조회 수: 3 (최근 30일)
Hisham Al Ashkar
Hisham Al Ashkar 2016년 7월 7일
댓글: Rodrigo Acuña 2017년 12월 19일
I have the following code in a GUI and I wanted to see the progress of the model, so I added a waitbar as below:
function pushbutton1_Callback(hObject, eventdata, handles)
set_param('Model','SimulationCommand','start'); % starts simulation
h = waitbar(0,'Please wait...');
steps = 1000;
for step = 1:steps
% computations take place here
waitbar(step / steps)
end
close(h)
When the waitbar runs, the Simulink model pauses. How can I make them run simultaneously?

답변 (1개)

Samah EL QASSAH
Samah EL QASSAH 2017년 9월 21일
I will reopen this question. I have the same problem and I don't know how to do it
  댓글 수: 1
Rodrigo Acuña
Rodrigo Acuña 2017년 12월 19일
StopTime = str2num(get_param('Simulink_Model_Name','StopTime'));
wbar = waitbar(0,'Please wait...');
while strcmp(get_param('Simulink_Model_Name','SimulationStatus'),'running')
waitbar(get_param('Simulink_Model_Name','SimulationTime')/StopTime);
pause(1);
end
close(wbar);

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by