How to insert two variables into a sprintf string?

조회 수: 5 (최근 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))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by