refer to: http://cn.mathworks.com/help/symbolic/mupad_ref/fopen.html
And: http://cn.mathworks.com/help/matlab/ref/fopen.html
Syntax
fopen(filename | TempFile, <Read | Write | Append>, <Bin | Text | Raw>, <Encoding = "encodingValue">)
|
| With If the mode is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| This option lets you specify the character encoding to use. The allowed encodings are:
The default encoding is system dependent. If you specify the encoding incorrectly, characters might read incorrectly. Characters unrecognized by the encoding are replaced by the default substitution character for the specified encoding. Encodings not listed here can be specified but might not produce correct results. |
Return Values
a positive integer: the file descriptor. FAIL is returned if the file cannot be opened.
Example
To specify the encoding to read and write data, use Encoding. TheEncoding option applies only to text files that are opened using a file name and not a file descriptor. Create a temporary file and write the string"abcäöü" in the encoding "UTF-8":
fid := fopen(TempFile, Text, Write, Encoding="UTF-8"): file := fname(fid): fprint(Unquoted, fid, "abcäöü"): fclose(fid):
本文详细介绍了MATLAB与MuPAD中fopen函数的语法、模式选项(Bin, Raw, Text)、编码选项以及返回值。通过实例展示了如何正确使用这些参数来读写文件,并特别关注了不同模式和编码对于数据处理的影响。
1435

被折叠的 条评论
为什么被折叠?



