How to find all the points of a given graph line

10 Ansichten (letzte 30 Tage)
Anas Blue
Anas Blue am 8 Jul. 2013
Hi everyone I want to find all the points from a plot and save it in array for example I've this graph I want all the point from the beginning of the line to the end of it
% Drawing a Trajectory
prompt={'Enter The Number Of Lines:'}; % Enter statements at the Command Window to accept input from you.
title='Draw Line '; % Name the Command Window
n=inputdlg(prompt); % Create and open input dialog box
% A = str2num(cell2mat(n)); % Convert from String to Int
A = sscanf(n{1}, '%d'); % Convert from String to Int
[x,y] = ginput(A); % Graphical input from mouse or cursor
plot(x,y)
posth = [x,y]; % Save 'x' and 'y' as Array
  2 Kommentare
Kartik  Katti
Kartik Katti am 9 Jul. 2013
You can use Image processing tool box on the graph to solve for the points which are black in color. I'm trying on those lines.
Anas Blue
Anas Blue am 9 Jul. 2013
Thanks man

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jan
Jan am 9 Jul. 2013
Bearbeitet: Jan am 10 Jul. 2013
The line from x(1)/y(1) to x(2)/y(2) has an infinite number of points in the mathematical sense. If you want the pixels on the screen, notice that the result will depend on the resolution of the monitor and several other settings.
So please explain again, which kind of "points" you want.
[EDITED] Look in the FileExchange for the Bresenham method: http://www.mathworks.com/matlabcentral/fileexchange/index?utf8=%E2%9C%93&term=Bresenham

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by