Main Content

Data Errors

Matrix Data Errors

Data in the MATLAB® or Microsoft® Excel® workspaces may produce the following errors.

Data Errors

Data Error

Cause

Solution

MATLAB matrix cells contain zeros (0).

Corresponding Excel worksheet cells are empty.

Excel worksheet cells must contain only numeric or string data.

MATLAB matrix is a 1-by-1 zero matrix.

You used quotation marks around the data-location argument in MLPutMatrix or MLAppendMatrix.

Correct the syntax to remove quotation marks.

MATLAB matrix is empty ([ ]).

You referenced a nonexistent VBA variable in MLPutVar.

Correct the macro; you may have typed the variable name incorrectly.

VBA matrix is empty.

You referenced a nonexistent MATLAB variable in MLGetVar.

Correct the macro; you may have typed the variable name incorrectly.

Errors When Opening Saved Worksheets

This section describes errors that you may encounter when opening saved worksheets.

  • When you open an Excel worksheet that contains Spreadsheet Link™ functions, the Excel software tries to execute the functions from the bottom up and right to left. Excel may generate cell error messages such as #COMMAND! or #NONEXIST!. This is expected behavior. Do the following:

    1. Ignore the messages.

    2. Close MATLAB figure windows.

    3. Execute the cell functions again one at a time in the correct order by pressing F2, and then Enter.

  • If you save an Excel worksheet containing Spreadsheet Link functions, and then reopen it in an environment where the excllink.xlam add-in is in a different location, you may see the message: This document contains links: Re-establish links?

    To address this issue, do the following:

    1. Click No.

    2. Select Edit > Links.

    3. In the Links dialog box, click Change Source.

    4. In the Change Links dialog box, select matlabroot\toolbox\exlink\excllink.xlam.

    5. Click OK.

      The Excel software executes each function as it changes its link. You may see MATLAB figure windows and hear error beeps as the links change and functions execute; ignore them.

    6. In the Links dialog box, click OK.

      The worksheet now connects to the Spreadsheet Link add-in.

    Or, instead of using the Links menu, you can manually edit the link location in each affected worksheet cell to show the correct location of excllink.xlam.