run two loop in different script

조회 수: 1(최근 30일)
mohammed alany
mohammed alany 2019년 5월 8일
댓글: mohammed alany 2019년 5월 9일
i am running a loop in the first script, and in the second script there is loop generate random number "rN".
and there is a condition in the first script says:
if rN > 0.9
how i can combine these two script ?????
  댓글 수: 7
mohammed alany
mohammed alany 2019년 5월 9일
1- rN values should they become available As soon as possible after they are generated?
2-while loop have to continue calculating till rN > 0.9, then (while loop have to stop to start another condition)

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

채택된 답변

Walter Roberson
Walter Roberson 2019년 5월 9일
%% animation part
while( distanceToGoal > goalRadius )
[v, omega] = step(controller, robot.CurrentPose);
drive(robot, v, omega)
robotCurrentLocation = robot.CurrentPose(1:2)
distanceToGoal = norm(robotCurrentLocation - robotGoal);
rN = rand;
disp(['rN = ' num2str(rN)])
if rN > 0.9
  댓글 수: 2
mohammed alany
mohammed alany 2019년 5월 9일
Many thanks dear

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

추가 답변(0개)


Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by