0

I am creating multiple handles for points taken from ginput(n) where n is no. of points to be taken. n is input from user.I want to create handles for all points and pass them using array to another function. SO code looks like this:

n=input('Enter no. of points  ');
[t]=ginput(n);
//I want to create handles for all points in t. 

function DrawBezier(//pass handles to this function )

I think one idea is to create an array and put handles in that. Now pass that array.

1
  • Did you try your idea? Passing the handles in an array is just about the only sensible option I think. And there's nothing wrong with it... Commented Oct 31, 2013 at 7:51

1 Answer 1

1

ginput doesn't return a handle, but the cooordinates of the points clicked, so you can do something like:

[x,y] = ginput(n); % x and y are n x 1 arrays

function DrawBezier(x,y)
Sign up to request clarification or add additional context in comments.

2 Comments

I will use impoint() after ginput(). impoint will create handles.
You should have said so in your original question. Once you have the coordinates x and y, you can create the handle using h = impoint(gca,x, y). If you have multiple points, you can create an array of x and y coordinates, as well as an array of handles, and pass these arrays to your function as arguments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.