How do i print '^' in sprintf?

1 visualización (últimos 30 días)
Kaelan Wade
Kaelan Wade el 19 de Mayo de 2017
Respondida: KSSV el 19 de Mayo de 2017
  • Just say
  • a = 2
  • b = 3
  • and i wanted to print " a*x^b " using sprintf
  • why is it when in use sprintf('%.2f*x^%.2f',a,b)
  • or even sprintf(%.2f*x%s%.2f',a,'^',b)
  • matlab prints 2.00*x3.00
  • How would I print " 2.00*x^3.00 " ?

Respuestas (1)

KSSV
KSSV el 19 de Mayo de 2017
a = 2 ;
b = 3 ;
sprintf('%d*x^%d',a,b)

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by