Database Toolbox    

NULL Values

In the example results, there are two NaN values in the data, which represent NULLS. You can specify how you want the query builder to represent NULL data.

  1. Select Preferences from the Query menu.

    The Preferences dialog box appears, showing the current settings for handling NULL values.

  1. Change values in the Preferences dialog box and click OK. For the example, change the value for Read NULL numbers as: from NaN to 0.
  2. Click Execute to run the query again.
  3. To see the results, type A in the Command Window.

    The results show 0's where previously there were NaN values.

Preferences apply to the current MATLAB session.

Another way to set preferences is by using the setdbprefs command. To use the same preferences whenever you run MATLAB, include the setdbprefs command in your startup file.


 Building, Running, and Saving a Query Using Retrieved Data in MATLAB