it make a ball move with serten speed and get it position data when it move
i = 1 ;
b_pos = [ 0 0 ] %% place to stor the position of the ball vector
b_val = [ 0.1 0.01 ]; %% valrition of the ball ( speed ) on x and y
ball = line(0.5,0.5,0 ,'marker','.','markersize', 40);
% ball movment movment_ball = makehgtform('translate', [b_val(1) + b_pos(1) , b_val(2) + b_pos(2) , 0])
while i==1
b_pos(1) = get(ball, 'XData');
b_pos(2) = get(ball, 'YData');
x_move = b_val(1) + b_pos(1);
y_move = b_val(1) + b_pos(2);
if ((y_move > 0.04) & (y_move < 0.90))
set(ball, 'XData', x_move ,'YData' , y_move);
end
if y_move == 0.9
break
end
set(ball, 'XData', x_move ,'YData' , y_move);
drawnow();
pause(0.1);
end
================================================= the eror Error using matlab.graphics.primitive.Line/get Invalid or deleted object.
Error in test_p (line 55) b_pos(1) = get(ball, 'XData');
i try make it in function but the same problem