I want to get data from table by push button and calculate and put the calculated data back in table but I have error.(user should enter all data for columns number 1 and 3 and just first cell of columns 2, 10 and 11. )

the code:

data = get(handles.ut1,’Data’);

if iscell(data);

data = cell2mat(data);

end

A = data(:,1);

[m n]=size(A);

G = zeros(m,n);

G(1) = data (1,2);

for i=2:m

G(i)=G(i-1)+A(i-1)-180;

if G(i)>360

G(i)=G(i)-360;

elseif G(i)<0

G(i)=G(i)+360;

end

end

d = data(:,3);

deltax = zeros(m,n) ;

deltay = zeros(m,n) ;

cx=zeros(m,n) ;

cy=zeros(m,n) ;

deltaxc = zeros(m,n) ;

deltayc = zeros(m,n) ;

for i = 1:m ;

G(i)=G(i)*(pi/180);

deltax(i)=d(i)*sin(G(i));

deltay(i)=d(i)*cos(G(i));

cx(i)=(-d(i))*(sum(deltax)/sum(d));

cy(i)=(-d(i))*(sum(deltay)/sum(d));

deltaxc(i)=deltax(i)+cx(i);

deltayc(i)=deltay(i)+cy(i);

end

x=zeros(m,n);

y=zeros(m,n);

x(1) = data (1,10);

y(1) = data (1,11);

for i=2:m;

x(i)= x(i-1)+deltaxc(i-1);

y(i)= y(i-1)+deltayc(i-1);

end

res = [A, G ,d, deltax, deltay, cx ,cy, deltaxc, deltayc ,x, y];

set(handles.ut1,'Data',num2cell(res))

Thank you

]]>Let me dedicated an upcoming video in the series to using runtests and adding asserts to the test script.

]]>assert(temp ==[0 -10], 'Saved temperatures weren't loaded correctly.');

…to your test script?

]]>