Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.3 - Français

Change language to:
English - 日本語 - Português

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Aide Scilab >> Sorties > sprintf

sprintf

Emulator of C language sprintf function

Calling Sequence

str=sprintf(format,value_1,..,value_n)

Arguments

format

a Scilab string. Specifies a character string combining literal characters with conversion specifications.

value_i

Specifies the data to be converted according to the format parameter.

str

column vector of character strings

Description

The sprintf function converts, formats, and stores its value parameters, under control of the format parameter.

The format parameter is a character string that contains two types of objects:

Literal characters

which are copied to the output stream.

Conversion specifications

each of which causes zero or more items to be fetched from the value parameter list. see printf_conversion for details

If there are not enough items for format in the value parameter list, sprintf generate an error. If any values remain after the entire format has been processed, they are ignored.

Note: sprintf is obsolete, use msprintf instead.

Examples

fahr=120
sprintf('%3d Fahrenheit = %6.1f Celsius',fahr,(5/9)*(fahr-32))

See Also

  • string — conversion en chaîne de caractères
  • print — prints variables in a file
  • write — write in a formatted file
  • format — number printing and display format
  • disp — displays variables
  • file — file management
  • printf — Emulator of C language printf function
  • fprintf — Emulator of C language fprintf function
  • msprintf — converts, formats, and writes data in a string
  • printf_conversion — printf, sprintf, fprintf conversion specifications
<< printf_conversion Sorties ssprint >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Oct 05 12:11:02 CEST 2011