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
c=('stop')
end
how i can combine these two script ?????
  7 件のコメント
mohammed alany
mohammed alany 2019 年 5 月 9 日
yas
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
break;
end
pause(2);
end
  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