Import Explorer to help you with importing table data
When importing data as a table, you can use detectImportOptions to customize how you bring in your data. You can choose to import specific columns, specify the data type of each column, specify how to treat missing values, and many more.
Import Explorer
Jan's entry is a visual tool to help with this customization. It also lets you save the output for detectImportOptions so that you can programmatically reproduce the operation. See this in action.
Programmatic Approach
As a comparision, here's how you would do it programmatically from scratch.
opts = detectImportOptions("airlinesmall.csv")
opts.VariableTypes([9 17 18]) = {'categorical'};
opts.SelectedVariableNames = opts.VariableNames([1 2 3 5 7 9 10 15 16 17 18]);
data = readtable("airlinesmall.csv",opts);
Import Tool
Of course, there is the Import Tool that comes with MATLAB. You can do many of these customizations from the tool.
Jan's Import Explorer gives you a bit more options, since detectImportOptions provides those. In addition, Jan's tool works with multiple files, in which case it uses the datastore function under the hood.
A small request I have is for this to work with other file types, such as Excel files. Currently, this tool only works with CSV and TXT files.
댓글
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.