Function problem. Where is wrong in my function and how can I add table headers.
显示 更早的评论


function output=dista(t)
global g
output=1/2*g.*t.^2;
global g
g=9.81;
t=0:10:100;
d=dista(d);
table=[t' d'];
filename='distance.xlsx';
xlswrite(filename,table);
v=d./t;
A=[table v'];
filename_last='Last Table.xlsx';
xlswrite(filename_last,A)
回答(1 个)
madhan ravi
2018-11-10
编辑:madhan ravi
2018-11-10
EDITED
t=0:10:100;
[d,v]=dista(t);
ttt=table(t',d',v')
ttt.Properties.VariableNames= {'t','d','v'};
writetable(ttt,'lastname.xlsx')
%--------------------------------
function [d,v]=dista(t)
g=9.81;
d=1/2*g.*t.^2;
v=d./t;
end
6 个评论
john parker
2018-11-10
编辑:john parker
2018-11-10
madhan ravi
2018-11-10
did it work?
john parker
2018-11-10
madhan ravi
2018-11-10
paste everything in red , meaning past the full error message here
john parker
2018-11-10
madhan ravi
2018-11-10
编辑:madhan ravi
2018-11-10
see edited answer now with attached screenshot
类别
在 帮助中心 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!