ERR

A cell that displays #ERR indicates that the cell could not execute its function correctly and is generally due to an invalid input parameter. An #ERR condition can occur for a variety of reasons, some due to normal operation of the vision application, and some due to errors in the spreadsheet logic itself. A few common occurrences of #ERR are noted below.

  1. Basic Mathematical Errors: Cell A4 = A3 / A2. If the value of cell A2 is equal to 0, then the function in cell A4 will generate a divide-by-zero error.
  2. Region Graphic Errors: Region moves off of the image. If you use a PatternMatch tool to locate something in the image, and then use the result data to fixture the location of other vision tools, it is possible for the region of a vision tool to be moved to a location causing part of the region to be outside the bounds of the image. When this occurs, the vision tool will report #ERR instead of returning a valid vision tool result structure.
  3. "Get" Functions fail: Vision Tool does not produce results if you use a GetX function in conjunction with an DetectBlobs tool, there may be conditions where the DetectBlobs tool fails to locate the expected number of blobs. If this occurs, the GetX function will report #ERR if the desired blob could not be located in the image.

Troubleshooting #ERR cells

Most #ERR conditions return an error string. To see if an error string is provided, simple hover the mouse over the cell containing the #ERR to show the error string. Also, if a red exclamation point appears in the Property Sheet, hover over it show the error string. Error strings can be returned programmatically, usingGetErrorString function. Each error string has an associated diagnostic code, which is returned using the GetErrorCode function.

How can I override #ERR to prevent error propagation?

Consider a case where you might want to compute the Sum of the areas for multiple blobs found by an DetectBlobs tool. You use the GetArea function to retrieve the area of individual blobs from the blob structure. If a blob is not found, the GetArea function will fail, but this may be a valid scenario in your application.

Cell

Function

Description

A1

DetectBlobs([Parameters])

Detects blobs and returns a Blobs structure

B1

GetArea(A1,0)

Returns the area of Blob 0

B2

GetArea(A1,1)

Returns the area of Blob 1

B3

GetArea(A1,2)

Returns the area of Blob 2

B4

Sum(B1:B3)

Computes the sum of the blob areas

If the DetectBlobs tool fails to locate at least 3 blobs, then the formula Sum(B1:B3) will report #ERR because at least one cell referenced by this formula will also report #ERR. To override this error condition, you can utilize the ErrFree Lookup function.

B4

Sum(ErrFree(B1:B3))

Computes the sum of the blob areas.

Note: When using the ErrFree function, the input values from other cells reporting #ERR will be converted to a value of 0; in this case, the Sum function will be adding 0 for any input #ERR cell instead of reporting an error.