フィルターのクリア

Import elements of an array from workspace

2 ビュー (過去 30 日間)
Islam Elnady
Islam Elnady 2018 年 1 月 22 日
コメント済み: Islam Elnady 2018 年 1 月 25 日
Hi, I've created this model in Simulink to import elements of an array of waypoints (x,y) from workspace on a sequential basis so that a Robot can follow them, point after point.
The index selectors switch to the next index by increasing the data store memory variable "A" by "1" when the Robot reaches the current waypoint within 100 m.
When I run the model the variable "A" jumps to the final value (16 in this case) at the first sample time of simulation. why? any help?
Below is the matlab function block:
function y = fcn(u,n)
global A;
if u<100 && A<n
A = A+1;
end
if A>n
A=n;
end
y = A;
end

回答 (1 件)

Manuel
Manuel 2018 年 1 月 23 日
Have you already tried using a LookUp table?
regards mscharff
  1 件のコメント
Islam Elnady
Islam Elnady 2018 年 1 月 25 日
No I didn't

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by