Customize Import Options Using Database Explorer App
You can customize import options using the Database Explorer app after creating an SQL query and before importing data into the MATLAB® Workspace. For details about creating SQL queries, see Create SQL Queries Using Database Explorer App.
Follow these steps as a general workflow to customize import options by using the Set Import Options dialog box. This workflow assumes that you create an SQL query that selects all data from a database table containing employee information.
In the Options section, click Import Options. The Set Import Options dialog box opens and displays the default general options.

Under Variable Name, enter a different name for a specific variable to change its name in the imported data.
Under Variable Type, select a different variable type for a specific variable to change its type in the imported data. The selected variable type must be compatible with the database type. For valid data types, see the
Option1,OptionValue1,...,OptionN,OptionValueNinput argument of thesetoptionsfunction.Under Missing Value, enter a different value for a specific variable to change how missing data is represented in the imported data. The data type of the specified value must match the variable type.
From the Option Type list, select
Text Options. The Set Import Options dialog box displays the import options for variables with text data types.
For details about customizing text import options, see the
Option1,OptionValue1,...,OptionN,OptionValueNinput argument of thesetoptionsfunction.After you select the
datetimevariable type for any variable in the general options, you can customize the datetime import options. For example, assume that you set the HIRE_DATE variable to thedatetimevariable type. From the Option Type list, selectDatetime Options. The Set Import Options dialog box displays the import options for variables withdatetimedata types.
For details about customizing datetime import options, see the
Option1,OptionValue1,...,OptionN,OptionValueNinput argument of thesetoptionsfunction.After you select the
categoricalvariable type for any variable in the general options, you can customize the categorical import options. For example, assume that you set the JOB_ID variable to thecategoricalvariable type. From the Option Type list, selectCategorical Options. The Set Import Options dialog box displays the import options for variables withcategoricaldata types.
For details about customizing categorical import options, see the
Option1,OptionValue1,...,OptionN,OptionValueNinput argument of thesetoptionsfunction.Click OK. The dialog box closes and the Data Preview pane shows a preview of the data using the import options.
In the Import section, click
to import all SQL query results as a table in
the MATLAB Workspace, according to the specified import options.In the Import section, select Import Data > Generate MATLAB Script to display a MATLAB script in the MATLAB Editor. The script mimics the actions of customizing import options in the Set Import Options dialog box for each option you set by using the
setoptionsfunction. For details about generating MATLAB scripts, see Generate SQL Query and MATLAB Script.