MATLAB: Getting Coordinate input from user

codeinput

I want to get several point 2d coordinates from the user and store the x and y coordinates in separate arrays. I'm using a for loop to do it but it doesn't assign the input to the variables, here's how I'm doing it:
for i=1:5
[x(i),y(i)]=input('Coordinates of Node')
end

Best Answer

According to the documentation, |input< has 1 output only:
help input
doc input
Then:
x = zeros(1, 5); % Pre-allocation
y = zeros(1, 5);
for i = 1:5
reply = input('Coordinates of Node')
x(i) = reply(1);
y(i) = reply(2);
end
The pre-allocation is not essential here, because waiting for the user input will take much more time than expanding the arrays x and y. But it is a good programming practice.