fopen user guide in MATLAB
2015-10-21 15:10
477 查看
refer to: http://cn.mathworks.com/help/symbolic/mupad_ref/fopen.html
And: http://cn.mathworks.com/help/matlab/ref/fopen.html
Syntax
fopen([code]filename | TempFile, <
Read | Write | Append>, <
Bin | Text | Raw>, <
Encoding = "encodingValue">)
[/code]
Bin, Raw, Text | With Bin, the data is stored in MuPAD internal binary format. With Text, the data may be strings or MuPAD objects stored as text. Newlines are handled according to the conventions of the operating system at hand. With Raw, the data is interpreted as binary machine numbers. See the functions readbytesand writebytes. If the mode is Reador Append, the default is the format of the data in the existing file. If the mode is Write, the default is Bin. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Encoding | 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.FAILis returned if the file cannot be opened.
Example
To specify the encoding to read and write data, useEncoding. The
Encodingoption 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之switch-case语句
- Matlab之if-else-end分枝语句
- Matlab之while循环语句
- Matlab之for循环语句
- Matlab字符串函数
- Matlab字符串的基本操作
- Matlab矩阵函数
- Matlab矩阵的运算
- Matlab矩阵的产生
- MATLAB语言中的关系与逻辑运算
- MATLAB系统命令
- MATLAB常用数学函数
- Matlab赋值语句
- Matlab变量及其命名规则
- MATLAB工作环境
- matlab 计算大型距离方阵,distance matrix
- MATLAB中的分类器
- matlab实现将彩色图像(R,G,B)色分量的直方图显示出
- MATLAB中图像处理的函数
- matlab实现将彩色图像(R,G,B)色分量的直方图匹配,并计算其相关性