Why am I getting the error "Invalid or Deleted Object"
Afficher commentaires plus anciens
This is my code
%constants A and B calculations
y1 = Mean(1);
x1 = Mean_step(1);
initial = y1*x1;
y2 = Mean(2);
x2 = Mean_step(2);
constant_B = (x2*y2-initial)/(y1-y2);
constant_A=(initial)+((y1)*constant_B);
%model calculation
Model = constant_A./(Mean_step + constant_B);
hp = plot(Mean_step, Model, 'r-', 'Linewidth', 1.5);
%%%dynamic text
txt1 = ['V_{preamp} = ' num2str(constant_A) ' / (Tool-Substrate Gap + (' num2str(constant_B) '))'];
ht = text(400, 650, txt1, 'FontSize', 9);
txt2 = ['Current V_{preamp} value = ' num2str(Mean(k)) '| Current Z-piezo distance = (' num2str(Mean_step(k)) '))'];
ht2 = text(400, 600, txt2, 'FontSize', 9);
txt3 =['Current Z-piezo distance = ' num2str(Mean_step(k)) ''];
ht3 = text(400, 550, txt3, 'FontSize', 9);
txt4 = ['Percentage Change = ' num2str(percent_change)];
ht4 = text(400 , 500, txt4, 'FontSize', 9);
%animated line handle, the line after the trailing dot
hh=animatedline('Marker','o','MarkerSize', 3,'MarkerFaceColor',[0.2 0.2 0.2]);
%trailing dot handle
h = plot(nan, nan, 'yo', 'MarkerSize', 5, 'MarkerFaceColor', 'g','MarkerEdgeColor','g'); %yellow, filled, large
for k = 2:length(Mean)
y2=Mean(k);
x2=Mean_step(k);
constant_B=(x2*y2-initial)/(y1-y2);
constant_A=(initial)+((y1)*constant_B);
Model = constant_A./(Mean_step + constant_B);
hp.YData = Model;
txt1 = ['V_{preamp} = ' num2str(constant_A) ' / (Tool-Substrate Gap + (' num2str(constant_B) '))'];
ht.String = txt1;
addpoints(hh, Mean_step(k), Mean(k))
txt2 = ['Current V_{preamp} value = ' num2str(Mean(k)) ' V'];
ht2.String = txt2;
txt3 =['Current Z-piezo distance = ' num2str(Mean_step(k)) ' \mum'];
ht3.String = txt3;
txt4 = ['Percentage Change = ' num2str(percent_change)];
ht4.String = txt4;
set(h, 'XData', Mean_step(k), 'YData', Mean(k));
drawnow()
end
1 commentaire
Hans123
le 9 Mai 2019
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!