How to insert two variables into a sprintf string?

6 ビュー (過去 30 日間)
Joe DuCharme
Joe DuCharme 2016 年 8 月 4 日
コメント済み: Joe DuCharme 2016 年 8 月 5 日
I have created an fft plot of some data where the peaks are labeled with their values. Each peak indicates the order for. The first peak is first order, second is second order, and so on. I want the data label to say 1,2,3... order = peak value. All I can come up with is how to get order = value. How can I make it so that I can insert another variable into sprintf.
Here is what I have so far..
for ii=2:13
o=(ii-1)
text(f(locs(ii)), pks(ii),sprintf(' Order = %6.3f N',pks(ii))))
end
How can I add the variable o before order?
I would appreciate any input.
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 8 月 4 日
You can make your question clear, explain your problem with an example and the expected result.

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

採用された回答

Walter Roberson
Walter Roberson 2016 年 8 月 4 日
sprintf('o = %g, Order = %6.3f', o, pks(ii))
  1 件のコメント
Joe DuCharme
Joe DuCharme 2016 年 8 月 5 日
Exactly what I was looking for. Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by