Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Data Marshaling Rules

Default Marshaling Rules

These types of data do not have natural mappings between MATLAB® and Excel®:

  • Dates: Excel has a special data type for dates, and MATLAB does not.

  • Blank cells: MATLAB has no equivalent construct for a blank cell in an Excel spread sheet.

If you do not change the marshaling rules when compiling the add-in, the rules for marshaling Excel data into MATLAB are:

  • Excel dates are marshaled into MATLAB doubles.

  • Empty cells are marshaled into zeros.

If you do not change the marshaling rules when compiling the add-in, the rules for marshaling MATLAB data into Excel are:

  • MATLAB NaNs are marshaled into Visual Basic® #QNANs.

  • MATLAB does not return any Excel dates.

Change Rules for Marshaling Data into MATLAB

You can change how dates and empty cells are marshaled into MATLAB when compiling the add-in:

  • Excel dates can be marshaled as MATLAB character arrays.

  • Empty cells can be marshaled as MATLAB NaNs.

To change the marshaling rules:

  1. In the class mapper portion of the MATLAB Compiler project window, select the signature of the function you want to modify.

  2. Select Data Conversion Properties from the context menu.

  3. Select the input argument rules to change.

  4. Click outside of the dialog box to close it.

Change Rules for Marshaling Data into Excel

You can change how dates and NaNs are marshaled into Excel when compiling the add-in:

  • MATLAB NaNs can be converted into zeros.

  • MATLAB numeric values can be converted into Excel dates.

    Note

    To see a date in the expected format, ensure that the Excel cell is formatted to display its contents in a date format.

To change the marshaling rules:

  1. In the class mapper portion of the MATLAB Compiler project window, select the signature of the function you want to modify.

  2. Select Data Conversion Properties from the context menu.

  3. Select the output argument rules to change.

  4. Click outside of the dialog to close it.

Was this topic helpful?