-3
A
回答
1
有许多方法来做到这一点,我通常用fread
fileId = fopen('mybinaryfile.dat','r'); %# open the file for reading
myData = fread(fileId,Inf,'double'); %# read everything (Inf) in the file as 'double' values
如果你的数据将很难适合在内存中,您可以使用多个访问读取
sizeToRead = 10000; %# limit size to 10000 values
fileId = fopen('mybinaryfile.dat','r'); %# open the file for reading
keepGoing=1; %# initialize loop
while(keepGoing)
%# read a maximum of 'sizeToRead' values
myData = fread(fileId,sizeToRead,'double');
%# ...
%# process your data here
%# ...
%# make the loop stop if end of file is reached or error happened
if numel(myData) ~= sizeToRead
keepGoing=0;
end
end
0
打开此文件中使用的FileStream,然后把它包装成BinaryReader在保存为二进制文件。它可以让你喜欢的readDouble,ReadByte等方法
相关问题
- 1. Matlab:从.csv文件读取
- 2. 从Matlab中的txt文件中读取
- 3. 从MATLAB中的文件读取图像
- 4. 从Matlab中的文件读取数据
- 5. PHP - 从平面文件读取,删除线和写回平面文件
- 6. 在matlab中读取文件
- 7. MATLAB读取文件
- 8. 无法读取平面文件源
- 9. 从平面文件中读取十进制领域的Java
- 10. 从junit测试中读取平面文件
- 11. 从平面文件中读取多个变量
- 12. SSIS从平面文件中读取问题
- 13. 从MATLAB开始读取文件
- 14. MATLAB - 从目录读取文件?
- 15. 如何从MATLAB读取文件?
- 16. 从平面文件读取文本到变量
- 17. 在Java平面文件中读取XML文件
- 18. 在Matlab中读取文本文件
- 19. 在MATLAB中读取文本文件?
- 20. 在matlab中读取文本文件
- 21. MATLAB CSV文件读取
- 22. 如何从MATLAB中的multipe文件夹读取很多文件?
- 23. 从matlab中的文件夹连续读取图像文件
- 24. 从asp.net平板文件读取数据
- 25. 从大型文本文件中读取Matlab中的数据
- 26. 如何从平面文件读取数百万条记录?
- 27. 从Java平面文件读取多个记录
- 28. 无法在Matlab中读取文件数据与文本读取
- 29. 从excel表中读取matlab
- 30. 在MatLab中读取二进制文件
更新了巨大数据文件处理的代码 –
如果numel(myData)〜= sizeToRead keepGoing = 0;结束 这是什么情况? – qwe
和先生laurent ,,,如何寻求在二进制文件中的具体位置,例如我想将指针(光标)从0(开始)移动到123 >>>? – qwe