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
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
john parker 2018년 11월 10일
편집: john parker 2018년 11월 10일
Sir how can I add t, d and v on table headline madhan ravi
Error in Untitled2 (line 4)
tt=table(t',d','VariableNames',{'t','d'})
gives this error
paste everything in red , meaning past the full error message here
Oh i delete workplace now it's works but how can I put in xls file this headlines?
madhan ravi
madhan ravi 2018년 11월 10일
편집: madhan ravi 2018년 11월 10일
see edited answer now with attached screenshot

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

릴리스

R2016a

질문:

2018년 11월 10일

편집:

2018년 11월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by