필터 지우기
필터 지우기

How to use sprintf to show variables side by side?

조회 수: 3 (최근 30일)
Jucimar Carpe
Jucimar Carpe 2018년 11월 26일
댓글: madhan ravi 2018년 11월 26일
Hi folks!
I'm working on a script with GUI interface and i have a edit text box where i want to display a code. This "code" will be created from the choices the user will make in the list boxes.
The problem is, i don't know how to display the variables side by side when using sprintf comannd. The code has number and letters: e.g. 121A43C456J23
Normally to display values in the boxes i use the syntax:
(set(handles.price,'string',sprintf('%g%+gi' , (final_price))))
Is there any way to do it?
Thanks
  댓글 수: 1
Stephen23
Stephen23 2018년 11월 26일
"i don't know how to display the variables side by side when using sprintf comannd"
Please show us an example of exactly how you want your text to look like.

댓글을 달려면 로그인하십시오.

채택된 답변

madhan ravi
madhan ravi 2018년 11월 26일
Use %s for letters and %d for numbers look in the documentation what they mean
  댓글 수: 2
Jucimar Carpe
Jucimar Carpe 2018년 11월 26일
Hi Madhan!
Thank you fo your help, i read the documentation and with your help i got the right code.
Thank you!
madhan ravi
madhan ravi 2018년 11월 26일
Anytime :) , cheers!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by