MATLAB Answers

Stacking in a loop

13 views (last 30 days)
Nik Rocky
Nik Rocky on 26 Jun 2020
Hello,
Every time I get stacked in for loop. Its happens just with one Dataset. The similar datasets (Traj_inerpl) working good.
I have one loop:
for traj_cnt = 1:length(Traj_interpl) %for every Traj-Cell
for t_row_cnt = 1:length(Traj_interpl{traj_cnt}) %for any row of Traj %%% I'm stacking here <<<<<<<<
if t_ref(t_ref_cnt) == Traj_interpl{traj_cnt}(t_row_cnt,1) %if right row of Traj is choosen
motorspeed_detected(traj_cnt) = Traj_interpl{traj_cnt}(t_row_cnt,2); %write detected value to array
break; %just one motorspeed_detected value is possible/no sence to follow a searching
else %%% If I do a pause I stay be here
motorspeed_detected(traj_cnt) = 0;
end
end
end
Within I create a motorspeed_detected array. I stay stacking while second for-loop. If I make a pause while stacking — program stay on else expression (not inside). When I left a pause — program starts running and work.
Variables on time of stacking:
t_ref_cnt = 1602 %Outside loop cnt
traj_cnt = 51 %every time different values
length(Traj_interpl) = 203
t_row_cnt = 115 %every time different values
length(Traj_interpl{traj_cnt}) = 119 %every time different values
t_ref(t_ref_cnt) = 17.7600 %every time different values
Traj_interpl{traj_cnt}(t_row_cnt,1) = 7.8300 %every time different values
motorspeed_detected(traj_cnt) = 0
What can be a reason?
Thank you!

  0 Comments

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!