Matlab中导入文件的命令大全三
2016-11-14 17:35
363 查看
1、使用fgetl和fgets函数读取文本文件数据
从文本文件中读取一行数据
data=fgetl(fileID)
data=fgets(fileID)
temp.txt
Day1
temp1=13
temp2=25
temp3=16
Day2
temp1=14
temp2=25
temp3=16
Day3
temp1=14
temp2=26
temp3=17
运行:
>> fid=fopen('temp.txt');
>> str1=fgetl(fid);
>> fseek(fid,0,'bof');
>> str2=fgets(fid);
>> fclose(fid);
>> uint8(str1)
ans =
68 97 121 49
>> uint8(str2)
ans =
68 97 121 49 13 10
2、使用fileread函数读取文本文件数据
text=fileread(filename)
>> s=fileread('temp.txt')
s =
Day1
temp1=13
temp2=25
temp3=16
Day2
temp1=14
temp2=25
temp3=16
Day3
temp1=14
temp2=26
temp3=17
从文本文件中读取一行数据
data=fgetl(fileID)
data=fgets(fileID)
temp.txt
Day1
temp1=13
temp2=25
temp3=16
Day2
temp1=14
temp2=25
temp3=16
Day3
temp1=14
temp2=26
temp3=17
运行:
>> fid=fopen('temp.txt');
>> str1=fgetl(fid);
>> fseek(fid,0,'bof');
>> str2=fgets(fid);
>> fclose(fid);
>> uint8(str1)
ans =
68 97 121 49
>> uint8(str2)
ans =
68 97 121 49 13 10
2、使用fileread函数读取文本文件数据
text=fileread(filename)
>> s=fileread('temp.txt')
s =
Day1
temp1=13
temp2=25
temp3=16
Day2
temp1=14
temp2=25
temp3=16
Day3
temp1=14
temp2=26
temp3=17
相关文章推荐
- Matlab中导入文件的命令大全一
- Matlab中导入文件的命令大全二
- oracle数据库文件中的导入/导出(imp/exp命令)
- sqlserver导入导出命令大全
- 批处理命令大全[编写安装文件必备]
- MATLAB常用命令大全
- matlab库函数命令大全
- [导入]redhat as4下文件管理常用命令
- Bat命令:从Ftp获取文件以及数据导入
- MATLAB文件操作相关命令
- oracle数据库文件中的导入/导出(imp/exp命令)
- MySQL数据导入导出csv文件命令
- oracle数据库文件中的导入/导出(imp/exp命令)详解
- 远程传送文件命令大全(ssh ftp)
- oracle数据库文件中的导入/导出(imp/exp命令)
- oracle导出导入dmp文件实用命令
- MATLAB 命令大全
- oracle数据库文件中的导入/导出(imp/exp命令)
- 远程传送文件命令大全
- matlab gui命令大全