I have a question about how to display a result in static text.

How I can write a whole resulted in a static test, ie; I get various data (S1, S2, etc) of a particular algorithm from certain inputs (E1, E2, etc) and I need an answer of the form : "The flow obtained for S1 is E1, and pressure line for this value is S2", inside of a static text.

回答 (2 件)

José-Luis
José-Luis 2014 年 9 月 17 日

0 投票

sprintf('The flow obtained for %f is %f, and pressure line for this value is %f',[1.1 pi exp(1)])
Saagar
Saagar 2014 年 9 月 17 日

0 投票

If S1 & S2 are numbers use num2str to convert them to strings. After that use strcat to make it a single string. it will be something like this:
strcat('The flow obtained for ',num2str(S1),' is',num2str(E1),', and pressure line for this value is ',num2str(S2))
or have i misunderstood what you want to do?

1 件のコメント

Saagar
Saagar 2014 年 9 月 17 日
Jose-Luis' method is cleaner though

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

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

タグ

質問済み:

2014 年 9 月 17 日

コメント済み:

2014 年 9 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by