# Error using double Conversion to double from cvx is not possible

Hi all, I am very new to CVX (and Matlab). I am having the following problem. I am minimising the objective:

``````sum(sum_square(p1(:,2:30)-p1(:,1:29)));
``````

subject to the following for loop:

``````for i = 1:29
V >= 700;
CL(i) = (W(i).*g)/(0.5*density*(V^2)*S);
CL >= 0;
CD(i) = CDo + ((CL(i).^2)/(3.14*AR*e));
CD >= 0;
T = ((CD(i)/CL(i))*(W(i)*g))/1000;
T >= 0;
thisArray = [p1(1,i), p1(2,i); p1(1,i+1), p1(2,i+1)];
cp(i) = {thisArray};
disp(i) = pdist(cp{i},'euclidean')*1000;
disp >= 0;
Wf(i) = SFC*T*(disp(i)/V);
Wf >= 0;
W(i+1) = W(i)-Wf(i);
end
``````

The following are given variables:

``````SFC = 0.94/60; g = 9.81; m = 77000; S = 122.60; CDo = 0.024;
W(1) = 77000; b = 34.10; e = 0.8; AR = (b^2)/S; density = 0.3494;
``````

p1 is defined as a 3x30 matrix representing x (row 1) y (row 2) and z (row 3) coordinate positions.

When I run this I get the following error:

``````Conversion to double from cvx is not possible.

Error in pdist (line 142)

X = double(X);

Error in fueloptimal (line 91)

disp(i) = pdist(cp{i},'euclidean')*1000;
``````

What is `pdist`? It is not a supported CVX function, that’s for sure.