Mercurial > octave-nkf
comparison doc/interpreter/io.txi @ 19630:0e1f5a750d00
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:24:46 -0500 |
parents | 05eb8eaf63d3 446c46af4b42 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19626:37d37297acf8 | 19630:0e1f5a750d00 |
---|---|
4 @c | 4 @c |
5 @c Octave is free software; you can redistribute it and/or modify it | 5 @c Octave is free software; you can redistribute it and/or modify it |
6 @c under the terms of the GNU General Public License as published by the | 6 @c under the terms of the GNU General Public License as published by the |
7 @c Free Software Foundation; either version 3 of the License, or (at | 7 @c Free Software Foundation; either version 3 of the License, or (at |
8 @c your option) any later version. | 8 @c your option) any later version. |
9 @c | 9 @c |
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT | 10 @c Octave is distributed in the hope that it will be useful, but WITHOUT |
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | 12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
13 @c for more details. | 13 @c for more details. |
14 @c | 14 @c |
15 @c You should have received a copy of the GNU General Public License | 15 @c You should have received a copy of the GNU General Public License |
16 @c along with Octave; see the file COPYING. If not, see | 16 @c along with Octave; see the file COPYING. If not, see |
17 @c <http://www.gnu.org/licenses/>. | 17 @c <http://www.gnu.org/licenses/>. |
18 | 18 |
19 @node Input and Output | 19 @node Input and Output |
167 @example | 167 @example |
168 @group | 168 @group |
169 load myfile.mat | 169 load myfile.mat |
170 A | 170 A |
171 @print{} A = | 171 @print{} A = |
172 @print{} | 172 @print{} |
173 @print{} 1 2 3 | 173 @print{} 1 2 3 |
174 @print{} 4 5 6 | 174 @print{} 4 5 6 |
175 @print{} 7 8 9 | 175 @print{} 7 8 9 |
176 @end group | 176 @end group |
177 @end example | 177 @end example |
515 | 515 |
516 In more detail, output conversion specifications consist of an | 516 In more detail, output conversion specifications consist of an |
517 initial @samp{%} character followed in sequence by: | 517 initial @samp{%} character followed in sequence by: |
518 | 518 |
519 @itemize @bullet | 519 @itemize @bullet |
520 @item | 520 @item |
521 Zero or more @dfn{flag characters} that modify the normal behavior of | 521 Zero or more @dfn{flag characters} that modify the normal behavior of |
522 the conversion specification. | 522 the conversion specification. |
523 @cindex flag character (@code{printf}) | 523 @cindex flag character (@code{printf}) |
524 | 524 |
525 @item | 525 @item |
526 An optional decimal integer specifying the @dfn{minimum field width}. | 526 An optional decimal integer specifying the @dfn{minimum field width}. |
527 If the normal conversion produces fewer characters than this, the field | 527 If the normal conversion produces fewer characters than this, the field |
528 is padded with spaces to the specified width. This is a @emph{minimum} | 528 is padded with spaces to the specified width. This is a @emph{minimum} |
529 value; if the normal conversion produces more characters than this, the | 529 value; if the normal conversion produces more characters than this, the |
530 field is @emph{not} truncated. Normally, the output is right-justified | 530 field is @emph{not} truncated. Normally, the output is right-justified |
536 printed) is used as the field width. The value is rounded to the | 536 printed) is used as the field width. The value is rounded to the |
537 nearest integer. If the value is negative, this means to set the | 537 nearest integer. If the value is negative, this means to set the |
538 @samp{-} flag (see below) and to use the absolute value as the field | 538 @samp{-} flag (see below) and to use the absolute value as the field |
539 width. | 539 width. |
540 | 540 |
541 @item | 541 @item |
542 An optional @dfn{precision} to specify the number of digits to be | 542 An optional @dfn{precision} to specify the number of digits to be |
543 written for the numeric conversions. If the precision is specified, it | 543 written for the numeric conversions. If the precision is specified, it |
544 consists of a period (@samp{.}) followed optionally by a decimal integer | 544 consists of a period (@samp{.}) followed optionally by a decimal integer |
545 (which defaults to zero if omitted). | 545 (which defaults to zero if omitted). |
546 @cindex precision (@code{printf}) | 546 @cindex precision (@code{printf}) |
557 | 557 |
558 @item | 558 @item |
559 A character that specifies the conversion to be applied. | 559 A character that specifies the conversion to be applied. |
560 @end itemize | 560 @end itemize |
561 | 561 |
562 The exact options that are permitted and how they are interpreted vary | 562 The exact options that are permitted and how they are interpreted vary |
563 between the different conversion specifiers. See the descriptions of the | 563 between the different conversion specifiers. See the descriptions of the |
564 individual conversions for information about the particular options that | 564 individual conversions for information about the particular options that |
565 they use. | 565 they use. |
566 | 566 |
567 @node Table of Output Conversions | 567 @node Table of Output Conversions |
760 @node Other Output Conversions | 760 @node Other Output Conversions |
761 @subsection Other Output Conversions | 761 @subsection Other Output Conversions |
762 | 762 |
763 This section describes miscellaneous conversions for @code{printf}. | 763 This section describes miscellaneous conversions for @code{printf}. |
764 | 764 |
765 The @samp{%c} conversion prints a single character. The @samp{-} | 765 The @samp{%c} conversion prints a single character. The @samp{-} |
766 flag can be used to specify left-justification in the field, but no | 766 flag can be used to specify left-justification in the field, but no |
767 other flags are defined, and no precision or type modifier can be given. | 767 other flags are defined, and no precision or type modifier can be given. |
768 For example: | 768 For example: |
769 | 769 |
770 @example | 770 @example |
883 | 883 |
884 @item | 884 @item |
885 A character that specifies the conversion to be applied. | 885 A character that specifies the conversion to be applied. |
886 @end itemize | 886 @end itemize |
887 | 887 |
888 The exact options that are permitted and how they are interpreted vary | 888 The exact options that are permitted and how they are interpreted vary |
889 between the different conversion specifiers. See the descriptions of the | 889 between the different conversion specifiers. See the descriptions of the |
890 individual conversions for information about the particular options that | 890 individual conversions for information about the particular options that |
891 they allow. | 891 they allow. |
892 | 892 |
893 @node Table of Input Conversions | 893 @node Table of Input Conversions |
971 | 971 |
972 @node String Input Conversions | 972 @node String Input Conversions |
973 @subsection String Input Conversions | 973 @subsection String Input Conversions |
974 | 974 |
975 This section describes the @code{scanf} input conversions for reading | 975 This section describes the @code{scanf} input conversions for reading |
976 string and character values: @samp{%s} and @samp{%c}. | 976 string and character values: @samp{%s} and @samp{%c}. |
977 | 977 |
978 The @samp{%c} conversion is the simplest: it matches a fixed number of | 978 The @samp{%c} conversion is the simplest: it matches a fixed number of |
979 characters, always. The maximum field with says how many characters to | 979 characters, always. The maximum field with says how many characters to |
980 read; if you don't specify the maximum, the default is 1. This | 980 read; if you don't specify the maximum, the default is 1. This |
981 conversion does not skip over initial whitespace characters. It reads | 981 conversion does not skip over initial whitespace characters. It reads |