Borrar filtros
Borrar filtros

How to use sprintf to show variables side by side?

3 visualizaciones (últimos 30 días)
Jucimar Carpe
Jucimar Carpe el 26 de Nov. de 2018
Comentada: madhan ravi el 26 de Nov. de 2018
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 comentario
Stephen23
Stephen23 el 26 de Nov. de 2018
"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.

Iniciar sesión para comentar.

Respuesta aceptada

madhan ravi
madhan ravi el 26 de Nov. de 2018
Use %s for letters and %d for numbers look in the documentation what they mean
  2 comentarios
Jucimar Carpe
Jucimar Carpe el 26 de Nov. de 2018
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 el 26 de Nov. de 2018
Anytime :) , cheers!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by