how can I display my result: the problem on fprintf command

2 ビュー (過去 30 日間)
Zeynep Toprak
Zeynep Toprak 2020 年 5 月 11 日
編集済み: Zeynep Toprak 2020 年 5 月 11 日
I write the code as follows:
expo_result = ['quantile of exponential distribution =', num2str(quantile_expo)];
normal_result = ['quantile of normal distribution =', num2str(quantile_normal)];
lognormal_result = ['quantile of lognormal distribution =', num2str(quantile_lognormal)];
gamma_result = ['quantile of gamma distribution =', num2str(quantile_gamma)];
fprintf(expo_result, '%s\n\r' );
fprintf(normal_result, '%s\n\r');
fprintf(lognormal_result, '%s\n\r');
fprintf(gamma_result, '%s\n\r');
But I see result on the command window as follows:
>> project_part_1
quantile of exponential distribution =6.5472e-05quantile of normal distribution =82.864quantile of lognormal distribution =55.4211quantile of gamma distribution=86.6666>>
How can I print them separately? Thanks a lot.

採用された回答

James Tursa
James Tursa 2020 年 5 月 11 日
The format string is first, not last. E.g.,
fprintf('%s\n\r', expo_result);
  1 件のコメント
Zeynep Toprak
Zeynep Toprak 2020 年 5 月 11 日
編集済み: Zeynep Toprak 2020 年 5 月 11 日
yeah it works! Thanks a lot!

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by