Using matrix data in Elipse E3.

This article illustrates how to work and perform operations with data grouped in matrices in Elipse E3.

To operate with matrices, use matriz.lib library. This library was created in order to have aritmetic operations performed in a matrix. The library basically consists of an XObject called XOArray containing several properties. This XObject’s properties list is as follows:

Lines: Displays the number of matrix’s lines in the XObject.

Columns: Displays the number of matrix’s columns in the XObject.

ArrayData: Stores the whole matrix. It is saved and updated whenever the matrix is generated or edited. This property contains a script that attributes values automatically to Lines and Columns properties.

SetLine1 and SetLine2: Used for operations with a specific number of lines; for example, to return values from Line 1 to Line 2.

SetColumn1 and SetColumn2: Used for operations with a specific number of columns; for example, to return values from Column 1 to Column 2.

Result: Returns the operations return’s value in the XObject.

NewValue: Used for storing a new value that was used for setting a value in the matrix.

ErrorMsg: Returns error messages; for example, if a value outside the valid range is attributed to SetLine1, the property will return the “LINE1 number invalid” string.

Operation: All operations with matrices are performed in this property. The operation is selected from a list of numbers linked to the property, as follows:

  • Sum from a specific area: Sums a specific amount of fields. To do so, associate values to SetLine1, SetLine2, SetColumn1, SetColumn2 properties, which will represent the sum’s limits. To perform this operation, add 1 to Operation property.
  • Average from the whole area: Calculates the average from a whole area in the matrix. Calcula a média de toda a região da matriz. To perform this operation, add 2 to Operation property.
  • Set: Sets a value to a desired field. To do so, associate the desired line’s and column’s values to SetLine1, SetColumn1 and NewValue properties. To perform this operation, add 3 to Operation property.
  • Sum from the whole area: Sums the whole matrix’s area. To perform this operation, add 4 to Operation property.
  • Search: Searches a desired field’s value. To do so, associate the desired line’s and column’s values to SetLine1 and  SetColumn1 properties. To perform this operation, add 5 to Operation property.
  • Sort out column in ascending order: Sorts out the values on a column in ascending order. To do so, associate the column’s value to SetColumn1 property. To perform this operation, add 6 to Operation property.
  • Sort out column in descending order: Sorts out the values on a column in descending order. To do so, associate the column’s value to SetColumn1 property. To perform this operation, add 7 to Operation property.
  • Switch columns: Switches values between two columns. To do so, associate the columns’ values to SetColumn1 and SetColumn2 properties. To perform this operation, add 8 to Operation property.
  • Switch lines: Switches values between two lines. To do so, associate the lines’ values to SetLine1 and SetLine2 properties. To perform this operation, add 9 to Operation property.
  • Sort out line in ascending order: Sorts out the values on a line in ascending order. To do so, associate the line’s value to SetLine1 property. To perform this operation, add 10 to Operation property.
  • Sort out line in descending order: Sorts out the values on a line in descending order. To do so, associate the line’s value to SetLine1 property. To perform this operation, add 11 to Operation property.
  • Average from a specific area: Calculates the area from a specific amount of fields. To do so, associate the average limit values to SetLine1, SetLine2, SetColumn1, SetColumn2 properties. These values stand for the average’s limits; for example, the sums of line 1 to line 2, and of column 1 to column 2. To perform this operation, add 12 to Operation property.

This library contains an XControl called XCArraySample, which is used for performing the operations in the matrix’s screen. In this XControl, you can create a matrix on screen and perform the desired operations. The figure below illustrates the XControl’s interface:

The Create ArrayData button is responsible for creating the matrix, record it in the XObject, and recreate the setpoint on screen with each value’s time. The uppermost display shows the value of Result property, that is, it returns the operations’ results. The lowermost display shows the value of ErrorMsg property, that is, it returns the error messages. The other buttons just attribute the corresponding number to Operation variable and perform the operation on screen. All functionalities from XOArray (XObject) can be viewed from XCArraySample (XControl).

Attached to this article is a demo application that demonstrates the library previously described.

Attachments:

4774

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *