0

I used e-puck robot that avoid obstacle using braitenberg in Matlab code, the program is running without any stop, i try to put the counter such like:

counter = 1;

while wb_robot_step(TIME_STEP) ~= -1

  if counter == 2000

save(counter,:)

 break;

  end

and at the end of the program i make a program save such like this:

save ('C:\Users\RAINAH\Desktop\data store\datastore2_net.mat','store');

to store the data,that can be used to train in artificial neural network, but the e-puck is still moving with a long time; so, what actually can i do?

Fluffeh
  • 33,228
  • 16
  • 67
  • 80

1 Answers1

0

The reason might be because of your TIME_STEP variable. It may not be changing in your loop. Also, your counter isn't doing anything either. It should probably be incrementing.

FYI: save(counter,:) doesn't make any sense. Are you trying to write a matrix to file? As such, do something like:

counter = 1;

while wb_robot_step(TIME_STEP) ~= -1

  if counter == 2000
      save matrix(counter,:); %// modified to suit your data variable
      break;
  end

  %// Do more processing code... maybe something
  %// with TIME_STEP
  %// ...

  %//**** INCREMENT COUNTER
  counter = counter + 1;

end

Can you post the entire code segment so we can see for ourselves? This code fragment that you have put on your post cannot reproduce your error.

rayryeng
  • 102,964
  • 22
  • 184
  • 193