This option is equivalent to changing the size of the plot box associated with the "paperposition" property. When using the command form of the print function you must quote the xsize , ysize option. For example, by writing "-S,".
See also: saveas , hgsave , orient , figure. Save graphic object h to the file filename in graphic format fmt. All device formats specified in print may also be used.
If fmt is omitted it is extracted from the extension of filename. The default format is "pdf". See also: print , hgsave , orient. Valid values for orientation are "portrait" , "landscape" , and "tall". The "landscape" option changes the orientation so the plot width is larger than the plot height.
The "paperposition" is also modified so that the plot fills the page, while leaving a 0. The "tall" option sets the orientation to "portrait" and fills the page with the plot, while leaving a 0.
The "portrait" option default changes the orientation so the plot height is larger than the plot width. It also restores the default "paperposition" property. If the argument hfig is omitted, then operate on the current figure returned by gcf. During intermediate stages it is often better to save the graphics object and all of its associated information so that changes—to colors, axis limits, marker styles, etc. Save the graphics handle h to the file filename in the format fmt.
When filename does not have an extension the default filename extension. As with save , the list of variables to extract can be full names or use a pattern syntax. The format of the file is automatically detected but may be overridden by supplying the appropriate option.
If a variable that is not marked as global is loaded from a file when a global symbol with the same name already exists, it is loaded in the global symbol table. Also, if a variable is marked as global in a file and a local symbol exists, the local symbol is moved to the global symbol table and given the value from the file.
If invoked with a single output argument, Octave returns data instead of inserting variables in the symbol table. If the data file contains only numbers TAB- or space-delimited columns , a matrix of values is returned. Otherwise, load returns a structure with members corresponding to the names of the variables in the file.
If compiled with zlib support, it can also load gzip-compressed files. It will automatically detect the type of file and do conversion from different floating point formats currently only IEEE big and little endian, though other formats may be added in the future.
This option is accepted for backward compatibility but is ignored. Octave now overwrites variables currently in memory with those of the same name found in the file. Force Octave to assume the file contains columns of numbers in text format without any header or other information.
Data in the file will be loaded as a single numeric matrix with the name of the variable derived from the name of the file. Force Octave to assume the file is in HDF5 format. Note that Octave can read HDF5 files not created by itself, but may skip some datasets in formats that it cannot support. Octave can now support multi-dimensional HDF data and automatically modifies variable names if they are invalid Octave identifiers.
See also: save , dlmwrite , csvwrite , fwrite. See also: fread , textread , sscanf. It is possible to write data to a file in a similar way to the disp function for writing data to the screen. The fdisp works just like disp except its first argument is a file pointer as created by fopen. See Opening and Closing Files , for details on how to use fopen and fclose. The value of r specifies the number of delimiter-only lines to add to the start of the file.
Either "on" or "off". See "-append" above. The character s to use to separate each row. Three special cases exist for this option. Any other value is used directly as the newline separator. The precision to use when writing the file. It can either be a format string as used by fprintf or a number of significant digits. See also: dlmread , csvread , csvwrite. Read the matrix data from a text file which uses the delimiter sep between data values. If the value being printed cannot be expressed precisely in the specified number of digits, the value is rounded to the nearest number that fits.
For example:. The corresponding argument must be a string. A precision can be specified to indicate the maximum number of characters to write; otherwise characters in the string up to but not including the terminating null character are written to the output stream.
Calls to scanf are superficially similar to calls to printf in that arbitrary arguments are read under the control of a template string. While the syntax of the conversion specifications in the template is very similar to that for printf , the interpretation of the template is oriented more towards free-format input and simple pattern matching, rather than fixed-field formatting.
For example, most scanf conversions skip over any amount of "white space" including spaces, tabs, and newlines in the input file, and there is no concept of precision for the numeric input conversions as there is for the corresponding output conversions.
Ordinarily, non-whitespace characters in the template are expected to match characters in the input stream exactly. When a matching failure occurs, scanf returns immediately, leaving the first non-matching character as the next character to be read from the stream, and scanf returns all the items that were successfully converted. The formatted input functions are not used as frequently as the formatted output functions.
Partly, this is because it takes some care to use them properly. Another reason is that it is difficult to recover from a matching error. Any whitespace character in the template causes any number of whitespace characters in the input stream to be read and discarded. The whitespace characters that are matched need not be exactly the same whitespace characters that appear in the template string.
Other characters in the template string that are not part of conversion specifications must match characters in the input stream exactly; if this is not the case, a matching failure occurs. See the descriptions of the individual conversions for information about the particular options that they allow. If the syntax of a conversion specification is invalid, the behavior is undefined.
If there aren't enough function arguments provided to supply addresses for all the conversion specifications in the template strings that perform assignments, or if the arguments are not of the correct types, the behavior is also undefined. On the other hand, extra arguments are simply ignored. Each of these specifies a number with decimal value They both permit either uppercase or lowercase letters to be used as digits.
The maximum field with says how many characters to read; if you don't specify the maximum, the default is 1. This conversion does not skip over initial whitespace characters.
It reads precisely the next n characters, and fails if it cannot get that many. It skips and discards initial whitespace, but stops when it encounters more whitespace after having read something. Octave has to C-style functions for reading and writing binary data. They are fread and fwrite and are patterned after the standard C functions with the same names. To flush output to a stream, use the function fflush file.
This is useful for ensuring that all pending output makes it to the screen before some other event occurs. For example, it is always a good idea to flush the standard output stream before calling input. Three functions are available for setting and determining the position of the file pointer for a given file. The position of the file pointer as the number of characters from the beginning of the file can be obtained using the the function ftell file.
To set the file pointer to any location within the file, use the function fseek file , offset, origin. See section Predefined Constants.
The function frewind file moves the file pointer to the beginning of a file, returning 1 for success, and 0 if an error was encountered. The function feof file allows you to find out if an end-of-file condition has been encountered for a given file.
Note that it will only return 1 if the end of the file has already been encountered, not if the next read operation will result in an end-of-file condition.
0コメント