How to insert two variables into a sprintf string?

5 visualizzazioni (ultimi 30 giorni)
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 Commento
Azzi Abdelmalek
Azzi Abdelmalek il 4 Ago 2016
You can make your question clear, explain your problem with an example and the expected result.

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 4 Ago 2016
sprintf('o = %g, Order = %6.3f', o, pks(ii))

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by