How to print variable into different rows?

6 visualizaciones (últimos 30 días)
SITI AISHAH
SITI AISHAH el 7 de Ag. de 2019
Editada: Adam Danz el 8 de Ag. de 2019
f = COF_S / C_ratio; % Coefficient of friction, f
e = Eccen_Rat_S ; % Eccentricity Ratio, e
Q = FV_S * r * c * N * L; % Lubricant Flow Rate, Q (m^3/s)
Qs = FR_S * Q ; % Lubricant Side Flow Rate, Qs (m^3/s)
Tmax = Temp_in + delta_T ; % Maximum Temperature, Tmax (°C)
ho = (MFT_S)*c; % Minimum Film Thickness,ho (m)
Phi = Pos_MFT_S ; % Position of minimum film thickness (deg)
Term_pos = TPF_S ; % Terminating position of film (deg)
Max_FP = P/(MFP_S); % Maximum Film Pressure, Pmax (Pascal,Pa)
pos_max_FP = PFMP_S ; % Position of maximum film pressure (deg)
T = f*W*r ; % Friction Torque, T (N.m)
Hp = (T*(N*60))/9550; % Frictional Horsepower, (hp)ƒ in(hp)
I was wondering on how to display/ print these variables into rows . I mean once I have run the script, I want to display all these variables with its respective values.
  1 comentario
Adam
Adam el 7 de Ag. de 2019
doc sprintf
with a \n after each one would do the job.

Iniciar sesión para comentar.

Respuesta aceptada

Adam Danz
Adam Danz el 7 de Ag. de 2019
Editada: Adam Danz el 8 de Ag. de 2019
If you just want to display the variables in the command window, merely list the variables without a terminal semicolon which would normally suppress the display.
f = COF_S / C_ratio; % Coefficient of friction, f
e = Eccen_Rat_S ; % Eccentricity Ratio, e
Q = FV_S * r * c * N * L; % Lubricant Flow Rate, Q (m^3/s)
Qs = FR_S * Q ; % Lubricant Side Flow Rate, Qs (m^3/s)
Tmax = Temp_in + delta_T ; % Maximum Temperature, Tmax (°C)
ho = (MFT_S)*c; % Minimum Film Thickness,ho (m)
Phi = Pos_MFT_S ; % Position of minimum film thickness (deg)
Term_pos = TPF_S ; % Terminating position of film (deg)
Max_FP = P/(MFP_S); % Maximum Film Pressure, Pmax (Pascal,Pa)
pos_max_FP = PFMP_S ; % Position of maximum film pressure (deg)
T = f*W*r ; % Friction Torque, T (N.m)
Hp = (T*(N*60))/9550; % Frictional Horsepower, (hp)ƒ in(hp)
% LATER IN YOUR CODE
% Without the semicolon at the end (;), these variable names and their values
% will all display in the command window.
f
e
Q
Qs
Tmax
ho
Phi
Term_pos
Max_FP
pos_max_FP
T
Hp
Another alternative is to collect the variables into cell array for a more compact display
c = {'f', f;
'e', e;
'Q', Q};
disp(c) % display c in command window

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by