MATLAB中,函数textscan和textread的区别

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/19 08:29:00
MATLAB中,函数textscan和textread的区别
xT]O@+& >k|vmvuV>Elh@ńbY3m<3I{ι?uwz/<^|M>2B3^2YaV0OMFH:G͹x}9NZg'sݍ(|, è2jR5QKym:V.Ff>;/[RJըы쥿7;z{ \(h@Yz('ZI6Wϗ 7O]/ыԗUE [vrF`P6N654c + PQ" 0fQVÞXpq U#ІMm! .fU,%<~;W. f"5OO mRFOF #. E/a\,2qGPZ?:@rZ<ϋfi1ZSJ5v@<#Y'`:-Q1r%fu(`^ ԫ0\.CYΘ5PD\].ŒMdh95NQ^@& bIְ0l jLX*V j#N8UXi^(ĭ;$*& kkPa\pnrrBp&)Wx

MATLAB中,函数textscan和textread的区别
MATLAB中,函数textscan和textread的区别

MATLAB中,函数textscan和textread的区别
textscan更适合读入大文件;
textscan可以从文件的任何位置开始读入,而textread 只能从文件开头开始读入;
textscan也可以从上一次textscan结束的位置开始读入,而textread不能;
textscan只返回一个数组,而textread要返回多个数组;
textscan提供更多转换读入数据的选择;
textscan提供给用户更多的配置参数.
总之就是说textscan比textread要牛.
参考:
# The textscan function offers better performance than textread, making it a better choice when reading large files.
# With textscan, you can start reading at any point in the file. Once the file is open, (textscan requires that you open the file first), you can seek to any position in the file and begin the textscan at that point. The textread function requires that you start reading from the beginning of the file.
# Subsequent textscans start reading the file at the point where the last textscan left off. The textread function always begins at the start of the file, regardless of any prior textread.
# textscan returns a single cell array regardless of how many fields you read. With textscan, you don't need to match the number of output arguments to the number of fields being read as you would with textread.
# textscan offers more choices in how the data being read is converted.
# textscan offers more user-configurable options.