make dot and count them

how to make dots (points) in an axes and count them.. may I use "ginput".. how i can make it..?? thank you.. ^^

댓글 수: 4

Jan
Jan 2012년 4월 12일
The question is not clear yet. How do you define where the dots appear? If you draw the plots in a program, there is no reason to count them afterwards, because the number of dots is known already.
Rahma Yeni
Rahma Yeni 2012년 4월 12일
i'm so sorry, if my question is not clear yet.. ^^
i want to make some dots in an axes..
because, sometimes i make much dots in an axes, so i must calculated how much dots that i has made.. value of the number of dots will be appear in a edit ...
Rahma Yeni
Rahma Yeni 2012년 4월 12일
I would prefer to explain it in pictures
http://www.flickr.com/photos/rye_ni/7070715047/
thank you before.. ^^
Jan
Jan 2012년 4월 12일
How do you "make some dots in an axes"? Isn't it possible to count the dots during creation already?

댓글을 달려면 로그인하십시오.

 채택된 답변

Thomas
Thomas 2012년 4월 12일

1 개 추천

Is this what you want
E.G.
close all
clear variables %changed from clear all on Jan's suggestion
disp('Hit return (enter) to stop entering points');
[x,y]=ginput; % hit return(enter) to stop entering points
plot(x,y,'MarkerFaceColor',[0 0 0],'MarkerEdgeColor',[0 0 0],'Marker','o','LineStyle','none');
num_points=(length(x))

댓글 수: 6

Jan
Jan 2012년 4월 12일
Is "close all; clear all" really helpful here?! Is it ever?!
Thomas
Thomas 2012년 4월 12일
not really helpful, but try, running this code twice without the 'close all' , you'll come to know, why I put it in..
Jan
Jan 2012년 4월 12일
I'd rather create the AXES explicitely than letting GINPUT do this implicitely and force colosing of all open figures.
"clear all" removes all loaded functions from the memory. Reading and parsing them again wastes a lot of time. Perhaps you want "clear variables".
Thomas
Thomas 2012년 4월 12일
I agree, that clear all removes all functions loaded from memory, but it is easier to type 'clear all' than 'clear variables' for small snipets of code :) .. As for the question of creating axes explicitly rather than have GINPUT create it, I would leave that up to the user.. I was just demonstrating a proof of concept based on an ambiguous question.
Jan
Jan 2012년 4월 12일
@Thomas, I would not have mentioned the problems of "clear all", if this appears less frequently in this forum. It does not cause any problems in your example. But I see it in so many examples, even as first line inside functions -where it is even weird-, that I suggest repeatedly to avoid it. A lot of FEX submissions contain "clear all, close all" and testing them can destroy my current work.
Rahma Yeni
Rahma Yeni 2012년 4월 13일
Thank you all..
i can applied the code to my problem.. ^^

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Exploration에 대해 자세히 알아보기

질문:

2012년 4월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by