stepan89
Newbie level 4
- Joined
- Aug 16, 2010
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Czech Republic
- Activity points
- 1,339
Hello everyone,
Can someone help me please with this code?
I have vectors (coordinates) x = [1 1 2 3 5 6 1 1 5] and y = [2 3 6 8 4 1 1 1 5]
If I plot them, everything's ok, it works...
plot(x, y, 'bo') for example...
Now I would like to delete some elemets, to be accurate: If the x OR y is less than or equal to 2 I would like to delete this elemet and plot without these coordinates ... I hope you do understand
That is my idea, but it doesn't work.
Please help if you can,
Thank you,
stepan89
Can someone help me please with this code?
I have vectors (coordinates) x = [1 1 2 3 5 6 1 1 5] and y = [2 3 6 8 4 1 1 1 5]
If I plot them, everything's ok, it works...
plot(x, y, 'bo') for example...
Now I would like to delete some elemets, to be accurate: If the x OR y is less than or equal to 2 I would like to delete this elemet and plot without these coordinates ... I hope you do understand
Code:
x = [1 1 2 3 5 6 1 1 5];
y = [2 3 6 8 4 1 1 1 5];
numberOfElements = numel(x);
for i=1:1:numberOfElements
if (x(i) > 3) || (y(i) > 3)
x(i) = [];
y(i) = [];
end;
end;
plot(x,y,'bo');
That is my idea, but it doesn't work.
Please help if you can,
Thank you,
stepan89