Fastest way to import CSV files in MATLAB

前端 未结 4 994
小鲜肉
小鲜肉 2020-12-16 22:07

I\'ve written a script that saves its output to a CSV file for later reference, but the second script for importing the data takes an ungainly amount of time to read it back

4条回答
  •  醉话见心
    2020-12-16 22:45

    I've had the same problem with reading csv data in Matlab, and I was surprised by how little support there is for this, but then I just found the import data tool. I'm in r2015b.

    On the top bar in the "Home" tab, click on "Import Data" and choose the file you'd like to read. An app window will come up like this:

    Import Data tool screenshot

    Under "Import Selection" you have the option to "generate function", which gives you quite a bit of customization options, including how to fill empty cells, and what you'd like the output data structure to be. Plus it's written by MathWorks, so it's probably utilizing the fastest available method to read csv files. It was almost instantaneous on my file.

提交回复
热议问题