本周文件交换精选

我们最好的用户提交

导入资源管理器帮助您导入表数据

汪东城 本周的选择是 为表导入资源管理器 通过 Jan Studnicka
当将数据作为表导入时,可以使用 detectImportOptions 自定义如何引入数据。您可以选择导入特定的列、指定每个列的数据类型、指定如何处理缺失的值等等。

进口的探险家

Jan的条目是一个可视化工具,可以帮助进行这种定制。它还允许您保存输出 detectImportOptions 以便您可以以编程方式重新生成操作。看看这个是怎么运作的。
import_explorer.gif

编程方法

作为比较,下面是从头开始编程的方法。
选择= detectImportOptions (“airlinesmall.csv”
选择=
DelimitedTextImportOptions with properties: Format properties: Delimiter:{','}空格:'\b\t ' LineEnding: {'\n' '\r' '\r\n'} CommentStyle: {} ConsecutiveDelimitersRule: 'split' LeadingDelimitersRule: 'keep' TrailingDelimitersRule: 'ignore' EmptyLineRule: 'skip' Encoding: 'Shift_JIS'替换属性:missinggrule:'fill' ImportErrorRule: 'fill' ExtraColumnsRule: 'addvars'变量导入属性:使用setvartype VariableNames: {'Year', 'Month', 'DayofMonth'…{'double', 'double', 'double'…and 26 more} SelectedVariableNames: {'Year', 'Month', 'DayofMonth'…和26}VariableOptions:显示所有29 VariableOptions访问VariableOptions sub-properties使用setvaropts / getvaropts VariableNamingRule:“修改”位置属性:DataLines:[2正]VariableNamesLine: 1 RowNamesColumn: 0 VariableUnitsLine: 0 VariableDescriptionsLine: 0显示表的预览,预览使用
选择。变量类型([9 17 18])= {“分类”};
选择。SelectedVariableNames =选择。变量名([1 2 3 5 7 9 10 15 16 17 18]);
数据= readtable (“airlinesmall.csv”、选择);

导入工具

当然,还有 导入工具 MATLAB自带的。您可以通过该工具进行许多这样的定制。
import_tool.png
Jan的Import Explorer为您提供了更多的选项,因为 detectImportOptions 提供这些。此外,Jan的工具可以处理多个文件,在这种情况下,它使用 数据存储 引擎盖下的功能。
我的一个小请求是,它可以处理其他类型的文件,比如Excel文件。目前,该工具仅适用于CSV和TXT文件。

评论

试试这个,让我们知道你的想法 在这里 或者离开 评论 1月。
|

评论

要留下评论,请点击在这里登录到您的MathWorks帐户或创建一个新帐户。