MATLAB Answers

Combine detectImportOptions with datastore?

6 views (last 30 days)
michel hillen
michel hillen on 24 Jul 2018
Commented: Chandan Nene on 9 Oct 2018
I have a set of files that I would like to process with a tabularTextDatastore. The content of the files has some specific format (many columns, special encoding, etc.) which is not properly detected by the datastore. Using detectImportOptions and readtable, I am able to load my files in the way that I want. Is there a way to use the 'opts' object that is generated with detectImportOptions as input to the datastore so that I don't have to 'manually' set the relevant Name,Value pairs?


Sign in to comment.

Accepted Answer

Harsh on 24 Jul 2018
Sounds like you'd like to do the following:
>> opts = detectImportOptions(file,'name',value...);
% Optionally configure various
>> ds=tabularTextDatastore(location', opts)
>> read(ds)
You're right in that currently none of the datastores accept an ImportOptions object. Manually configuring the relevant Name,Value pairs is the suggested approach for now.

  1 Comment

Chandan Nene
Chandan Nene on 9 Oct 2018
Is this (that is, allowing ImportOptions to be passed to datastore) planned to be included in near future?

Sign in to comment.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by