Making a table in matlab

6 次查看(过去 30 天)
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