MATLAB: Error with table subtraction

cell arraysindexingMATLABstructurestable

At the line d1, error appears that '-' is undefined operator. If bsxfun is used, error on numeric arrays is shown. Conversion of table type (before and after d1) leads to different errors. Please, suggest suitable modification with data format table.
a=[0.5;0.6;0.9;1.0;1.6]
b=[2.0;1.5;1.3;2.8;3.2]
c=[-0.1;0.4;0.5;1.1;1.4]
T=table(a,b,c)
for i=2:size(T,1)
if T{i,'a'}>T{i-1,'a'}
d=min(T{i,:})
else
d=0
end
d1=sum(d-T,2)
end

Best Answer

First, change the first three line with their transposes.
a=[0.5 0.6 0.9 1.0 1.6].'
b=[2.0 1.5 1.3 2.8 3.2].'
c=[-0.1 0.4 0.5 1.1 1.4].'
Then, change the line
d1=sum(d-T,2)
to
d1=sum(d-table2array(T),2)