Adding text to the plot values in the plot

10 vues (au cours des 30 derniers jours)
Gova ReDDy
Gova ReDDy le 10 Oct 2011
Hi..Am plotting the different values of slopes of lines in a single plot .But I want to indicate each plotted value with the respective line number how can I do this.. previously I am storing slope values in slope(K).. then am using
for k=1:n
plot(slope,'*')
end
Can someone suggest about this...
  1 commentaire
Image Analyst
Image Analyst le 10 Oct 2011
Why do you need/want the for loop? The plot function call will plot the whole thing - the whole slope array. You're just plotting the whole thing n times.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 10 Oct 2011
Either use legend(), or text() a label in place somewhere along the line.
  9 commentaires
Walter Roberson
Walter Roberson le 20 Oct 2011
isempty() can tell you whether there was a result from find() or not.
But again, what if there were (say) 5 values found?
Gova ReDDy
Gova ReDDy le 20 Oct 2011
Am plotting the "slope" value against "frames".
for k = 1 :240 %no.of frames
%Here in loop am extracting the line from each frame then
[ycoord,xcoord]=find(line);%finding the coordinates of line
Ymax(k)=max(ycoord);
Ymin(k)=min(ycoord);
Xmax(k)=max(xcoord);
Xmin(k)=min(xcoord);
slope(k)=(Ymax(k)-Ymin(k)/Xmax(k)-Xmin(k));%slope=y2-y1/x2-x1
end;
plot(slope,'-ro');%plotting slope values of frames
xlabel('Fame number');
ylabel('SLOPE Of Line In the Frame ');
title('SLOPE PLOT of the VIDEO');
when there is no line in the next frame then the slope value should be zero..
else it should calculate the slope value .

Connectez-vous pour commenter.

Plus de réponses (1)

Gova ReDDy
Gova ReDDy le 24 Oct 2011
This is working
if((isempty(xcoord)=1) && (isempty(xcoord)=1))
then
caluclate slope
else
slope=0;
end

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by