~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to man/fileio/mprintf.cat

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
mprintf           Scilab Group           Scilab Function            mprintf
 
2
NAME
 
3
    mfprintf - converts, formats, and writes  data to a file   mprintf -
 
4
  converts, formats, and writes  data to the main scilab window  msprintf -
 
5
  converts, formats, and writes  data in a string
 
6
  
 
7
CALLING SEQUENCE
 
8
 mfprintf(fd,format,a1,...,an);
 
9
 mprintf(format,a1,...,an);
 
10
 str=msprintf(format,a1,...,an);
 
11
PARAMETERS
 
12
 fd : scalar, file descriptor given by mopen (it's a positive
 
13
             integer). The value -1 refers to the default file ( i.e the last opened
 
14
            file).
 
15
            
 
16
 format     : a Scilab string describing  the format to use to write  the 
 
17
            remaining  operands.  The format operand follows, as close as
 
18
            possible,  the C printf format operand syntax. 
 
19
            
 
20
 str        : a character string, string to be scanned.
 
21
            
 
22
 a1,...,an  : Specifies the data to be converted and printed according to
 
23
            the format parameter.
 
24
            
 
25
DESCRIPTION
 
26
   The mprintf, mfprintf, and msprintf functions are interface for C-coded
 
27
  version of printf, fprintf and sprintf functions.
 
28
  
 
29
   The mprintf function  writes formatted operands to the standard Scilab
 
30
  output (i.e the Scilab window). The  argument operands are formatted
 
31
  under control of the format operand.
 
32
  
 
33
   The mfprintf function writes formatted operands to the file specified by
 
34
  the file desciptor  fd. The  argument operands are formatted under
 
35
  control of the format operand.
 
36
  
 
37
   The msprintf  writes formatted operands in its returned value (a Scilab
 
38
  string). The  argument operands are formatted under control of the format
 
39
  operand. Note that, in this case, the  escape sequences ("\n, \t,..") are
 
40
  treated as a normal sequence of characters.
 
41
  
 
42
   All these functions may be used to output column vectors of numbers and
 
43
  string vectors without an explicit loop on the elements. In that case
 
44
  these functions iterates on the rows. The shortest vector gives the
 
45
  number of time the format has to be iterated.
 
46
  
 
47
   An homogeneous sequence of identical type parameters can be replaced by a
 
48
  matrix 
 
49
  
 
50
EXAMPLE
 
51
 mprintf('At iteration %i, Result is:\nalpha=%f',33,0.535)
 
52
 
 
53
 msprintf('%5.3f %5.3f',123,0.732)
 
54
 msprintf('%5.3f\n%5.3f',123,0.732)
 
55
 
 
56
 A=rand(5,2);
 
57
 // vectorized forms: the format directive needs 
 
58
 // two operand, each column of A is used as an operand. 
 
59
 // and the mprintf function is applied on each row of A 
 
60
 mprintf('%5.3f\t%5.3f\n',A)
 
61
 
 
62
 colors=['red';'green';'blue';'pink';'black'];
 
63
 RGB=[1 0 0;0 1 0;0 0 1;1 0.75 0.75;0 0 0];
 
64
 mprintf('%d\t%s\t%f\t%f\t%f\n',(1:5)',colors,RGB)
 
65
 
 
66
SEE ALSO
 
67
   mclose, meof, mfprintf, fprintfMat, mfscanf, fscanfMat, mget, mgetstr,
 
68
  mopen, mprintf, mput, mputstr, mscanf, mseek, mtell 
 
69