How to fix the" Error using handle.handle/get Invalid or deleted object"?
Show older comments
I Wrote this code to program but got this error. Any tips to fix this please? thank you.
%% Main Code
% Initialise the graph
Rect_ne_1 = plot(NaN,NaN, '-b');%Open empty graph. NaN - Not a number.
axis([-10 10 -10 10]); grid on;
title('\fontname{Georgia}\fontsize{12}\color{black} \Theta = ');
Vector_new_for_Rectangle = plot(NaN,NaN, '-r');
axis([-10 10 -10 10]); grid on;
%main
a1 = 2;
a2 = 6;
a3 = 4;
for thetad =1:90;
R = [cosd(thetad) -sind(thetad); sind(thetad) cosd(thetad)];
x2 = R*[a1;a1];
x3 = R*[a2;a2];
y2 = R*[a1;a3];
y3 = R*[a3;a1];
x1 = [a1; a1; a2; a2; a1];
y1 = [a1; a3; a3; a1; a1];
v1 = [get(Rect_ne_1, 'XData'), x1];
v2= [get(Rect_ne_1, 'YData'), y1];
set(Rect_ne_1, 'XData', v1, 'YData', v2);
drawnow;
v3 = [get(Vector_new_for_Rectanle, 'XData'), [x2;x3]];
v4= [get(Vector_new_for_Rectanle, 'YData'), [y2;y3]];
set(Vector_new_for_Rectanle, 'XData', v3, 'YData', v4);
drawnow;
pause(0.1);
end
1 Comment
Mara
on 21 Jun 2020
Hello, depending on where the error occurs, MATLAB can either not find Rect_ne_1 or Vector_new_for_Rectanle...is there maybe a typo and it is called Rectangle?
Answers (0)
Categories
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!