From: Gavin Dooley on
This is an example of the data points which i need to surf, it looks like a plane in plit3 but not in surf:
10.0000 10.0000 10.0000
10.0000 13.2441 10.0000
10.0000 16.4883 10.0000
10.0000 19.7324 10.0000
13.1786 10.0000 10.0000
13.1786 13.2441 10.0000
13.1786 16.4883 10.0000
13.1786 19.7324 10.0000
16.3572 10.0000 10.0000
16.3572 13.2441 10.0000
16.3572 16.4883 10.0000
16.3572 19.7324 10.0000
19.5358 10.0000 10.0000
19.5358 13.2441 10.0000
19.5358 16.4883 10.0000
19.5358 19.7324 10.0000
From: Wayne King on
"Gavin Dooley" <dooleygj(a)tcd.ie> wrote in message <hjf5t6$l31$1(a)fred.mathworks.com>...
> Thanks for the ans to my first question that will quicken up my programming no end!
>
> 2) Im looking to sort say the 2 column in a 100x3 matrix in ascending order, the dimension one is not working for me.
>
> if
> q =
>
> 1 2 3
> 4 0 1
> 7 9 6
> 3 5 7
>
> using px = sort(q,2)
> I get:
> px =
>
> 1 2 3
> 0 1 4
> 6 7 9
> 3 5 7
>
> I want
> 4 0 1
> 1 2 3
> 3 5 7
> 7 9 6
>
> Thanks,
Hi Gavin, one way

[Y,Indices] = sort(q(:,2));
P = q(Indices,:);

Wayne
From: Wayne King on
"Gavin Dooley" <dooleygj(a)tcd.ie> wrote in message <hjf6r6$k7e$1(a)fred.mathworks.com>...
> This is an example of the data points which i need to surf, it looks like a plane in plit3 but not in surf:
> 10.0000 10.0000 10.0000
> 10.0000 13.2441 10.0000
> 10.0000 16.4883 10.0000
> 10.0000 19.7324 10.0000
> 13.1786 10.0000 10.0000
> 13.1786 13.2441 10.0000
> 13.1786 16.4883 10.0000
> 13.1786 19.7324 10.0000
> 16.3572 10.0000 10.0000
> 16.3572 13.2441 10.0000
> 16.3572 16.4883 10.0000
> 16.3572 19.7324 10.0000
> 19.5358 10.0000 10.0000
> 19.5358 13.2441 10.0000
> 19.5358 16.4883 10.0000
> 19.5358 19.7324 10.0000

Hi Gavin, did you read the documentation for meshgrid() as I suggested in the earlier post?

Example of a plane:

x = -5:0.1:5;
y = -5:0.1:5;
[X,Y] = meshgrid(x,y);
Z = 2*X+Y;
surf(X,Y,Z);

Hope that helps,
Wayne