How to print variable into different rows?

3 ビュー (過去 30 日間)
SITI AISHAH
SITI AISHAH 2019 年 8 月 7 日
編集済み: Adam Danz 2019 年 8 月 8 日
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 件のコメント
Adam
Adam 2019 年 8 月 7 日
doc sprintf
with a \n after each one would do the job.

サインインしてコメントする。

採用された回答

Adam Danz
Adam Danz 2019 年 8 月 7 日
編集済み: Adam Danz 2019 年 8 月 8 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by