Making a table in matlab

조회 수: 3 (최근 30일)
Adnan
Adnan 2024년 2월 12일
댓글: Adnan 2024년 2월 12일
I have three vectors in 1x9 form and i am trying to make a table with them but when I do it, it displays 1x9 double

채택된 답변

Austin M. Weber
Austin M. Weber 2024년 2월 12일
% Example
vector1 = [1 2 3 4 5 6 7 8 9];
vector2 = [1 2 3 4 5 6 7 8 9];
vector3 = [1 2 3 4 5 6 7 8 9];
% Combine into an array
array = [vector1; vector2; vector3];
% Convert to table
table = array2table(array);
% Give the columns names
variable_names = {'Var1','Var2','Var3','Var4','Var5','Var6','Var7','Var8','Var9'};
table.Properties.VariableNames = variable_names
table = 3×9 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 ____ ____ ____ ____ ____ ____ ____ ____ ____ 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
  댓글 수: 1
Adnan
Adnan 2024년 2월 12일
thank you, i ended making this code
a = input('Enter a value for a: \n');
b = input('Enter a value for b: \n');
c = input('Enter a value for c: \n');
T1 = input('Enter a value for T1: \n');
T2 = input('Enter a value for T2: \n');
o = 5.669 * 10^-8;
X = a/c;
Y = c/b;
Z = 1 + (1+X^2)*Y^2;
F12 = .5*(Z - sqrt(Z^2-4*X^2*Y^2));
q = o*pi*b^2*F12*(T1^4-T2^4);
fprintf('The radius of plate 1 is %dm. \n',a)
fprintf('The radius of plate 2 is %dm. \n',b)
fprintf('The temperature of plate 1 is %dK. \n',T1)
fprintf('The temperature of plate 2 is %dK. \n',T2)
fprintf(' The radiation heat exchange is %.2f watts. \n',q)
separation_m = c;
radiation_heat_exchange_watts = q;
T = table(separation_m,radiation_heat_exchange_watts)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Direct Search에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by