'p%d=%.8f\n',i,c what doess it mean

5 visualizaciones (últimos 30 días)
Edison
Edison el 29 de Dic. de 2022
Respondida: Voss el 29 de Dic. de 2022
what does the above code means

Respuestas (1)

Voss
Voss el 29 de Dic. de 2022
The part before the first comma ('p%d=%.8f\n') looks like a format specifier, as would be used in sprintf or fprintf. It means: print a "p" followed by an integer followed by "=" followed by a floating-point number with 8 decimal places followed by a new-line character.
The i and c would be subsequent arguments so that i would be the integer printed and c would be the floating-point number.
For example:
i = 3;
c = 0.123;
sprintf('p%d=%.8f\n',i,c)
ans =
'p3=0.12300000 '

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by