This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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,OptionValueN input argument of the setoptions function.

  • 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,OptionValueN input argument of the setoptions function.

  • After you select the datetime variable 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 the datetime variable type. From the Option Type list, select Datetime Options. The Set Import Options dialog box displays the import options for variables with datetime data types.

    For details about customizing datetime import options, see the Option1,OptionValue1,...,OptionN,OptionValueN input argument of the setoptions function.

  • After you select the categorical variable 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 the categorical variable type. From the Option Type list, select Categorical Options. The Set Import Options dialog box displays the import options for variables with categorical data types.

    For details about customizing categorical import options, see the Option1,OptionValue1,...,OptionN,OptionValueN input argument of the setoptions function.

  • 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 setoptions function. For details about generating MATLAB scripts, see Generate SQL Query and MATLAB Script.

See Also

Apps

Related Topics