词条 | save函数 |
释义 | SAVE Save workspace variables to disk. SAVE FILENAME saves all workspace variables to the binary "MAT-file" named FILENAME.mat. The data may be retrieved with LOAD. If FILENAME has no extension, .mat is assumed. SAVE, by itself, creates the binary "MAT-file" named 'matlab.mat'. SAVE FILENAME X saves only X. SAVE FILENAME X Y Z saves X, Y, and Z. The wildcard '*' can be used to save only those variables that match a pattern. SAVE FILENAME -REGEXP PAT1 PAT2 can be used to save all variables matching the specified patterns using regular expressions. For more information on using regular expressions, type "doc regexp" at the command prompt. SAVE FILENAME -STRUCT S saves the fields of the scalar structure S as individual variables within the file FILENAME. SAVE FILENAME -STRUCT S X Y Z saves the fields S.X, S.Y and S.Z to FILENAME as individual variables X, Y and Z. SAVE FILENAME ... -APPEND adds the variables to an existing file (MAT-file only). Format Options: SAVE ... -ASCII uses 8-digit ASCII form instead of binary regardless of file extension. SAVE ... -ASCII -DOUBLE uses 16-digit ASCII form. SAVE ... -ASCII -TABS delimits with tabs. SAVE ... -ASCII -DOUBLE -TABS 16-digit, tab delimited. SAVE ... -MAT saves in MAT format regardless of extension. Version Compatibility Options: The following options enable you to save your workspace data to a MAT-file that can then be loaded into an earlier version of MATLAB. The resulting MAT-file supports only those data items and features that were available in this earlier version of MATLAB. (See the second table below for what is supported in each version.) Command Option | Saves a MAT-File That You Can Load In -----------------+---------------------------------------------- SAVE ... -V7.3 | Version 7.3 or later -----------------+---------------------------------------------- SAVE ... -V7 | Versions 7.0 through 7.2 (or later) -----------------+---------------------------------------------- SAVE ... -V6 | Versions 5 and 6 (or later) -----------------+---------------------------------------------- SAVE ... -V4 | Versions 1 through 4 (or later) To make one of these options the default for all of your MATLAB sessions, use the Preferences dialog box. In the MATLAB File menu, select Preferences. Then, in the Preferences dialog box, click General and then MAT-Files. MATLAB Versions | Data Items or Features Supported -----------------+---------------------------------------------- 4 and earlier | Support for 2D double, character, and sparse | arrays -----------------+---------------------------------------------- 5 and 6 | Version 4 capability plus support for | ND arrays, structs, and cells -----------------+---------------------------------------------- 7.0 through 7.2 | Version 6 capability plus support for data | compression and Unicode character encoding -----------------+---------------------------------------------- 7.3 and later | Version 7.2 capability plus support for | data items greater than or equal to 2GB Examples for pattern matching: save fname a* % Save variables starting with "a" save fname -regexp \\d % Save variables containing any digits Examples for specifying filename and variables: save mydata.mat v1 % Use with literal filename save 'my data file.mat' v1 % Use when filename has spaces save(savefile, 'v1') % Use when filename is stored in a variable |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。