Stuart’s MATLAB Videos

Watch and Learn

Using detectImportOptions with Large Text Files

Yesterday, I was loading a CSV file of about 1 million rows and 300 columns, comprising lots of string variables. It took a while to load, then I remembered I only needed 1 or 2 columns and how detectImportOptions helps you specify which columns to load. It lets you specify the variable names in the header to include, which is much easier than specifying column indices, especially if columns move around.

In fact, detectImportOptions combined with readtable is now my main method of loading subsets of data from large text files. Gone are the days of trying to calculate format strings with textscan. In the past, I even made this submission textscantool on the File Exchange to calculate the format strings for text files with many columns.

Features covered in this code-along style video include:

Play the video in full screen mode for a better viewing experience. 

|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.