How to print variable into different rows?

2 vues (au cours des 30 derniers jours)
SITI AISHAH
SITI AISHAH le 7 Août 2019
Modifié(e) : Adam Danz le 8 Août 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 commentaire
Adam
Adam le 7 Août 2019
doc sprintf
with a \n after each one would do the job.

Connectez-vous pour commenter.

Réponse acceptée

Adam Danz
Adam Danz le 7 Août 2019
Modifié(e) : Adam Danz le 8 Août 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

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by