Making a table in matlab

3 vues (au cours des 30 derniers jours)
Adnan
Adnan le 12 Fév 2024
Commenté : Adnan le 12 Fév 2024
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

Réponse acceptée

Austin M. Weber
Austin M. Weber le 12 Fév 2024
% 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 commentaire
Adnan
Adnan le 12 Fév 2024
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)

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by