Show / Hide Table of Contents

Class MatrixAccessor

Matrix accessors are a way of interacting with the data of a parent Matrix through a special lens, without copying the data into a new Matrix and then back again. This type of Matrix works by creating a function that converts the I-based indexing of the accessor matrix into the I-based indexing of the parent matrix, then using it to intercept calls to GetI and SetI. Concrete Matrix Accessor Classes can be easily created from the parent MatrixAccessor abstract class by implementing the This2Parent method in order to define the index conversion.

note

Note that matrix accessor allow both read and write access to the parent matrix!

warning

Matrix Accessors inherently store a pointer (BY REFERENCE) to their parent matrix. If the parent matrix goes out of scope (through function return) or is moved (through an online change) then the Matrix Accessor will no longer work. Therefore, they are best used quickly then destroyed, all within the scope of a single F or FB.

Inheritance
System.Object
Matrix
MatrixAccessor
ShrunkMatrixAccessor
SubMatrixAccessor
TransposeMatrixAccessor
Inherited Members
Matrix.Clear()
Matrix.CopyFrom(Object)
Matrix.ElementDifference(Object)
Matrix.ElementProduct(Object)
Matrix.ElementSum(Object)
Matrix.FillFrom(Object)
Matrix.FillTrapezoidal(Object, Object, Object)
Matrix.GetRC(Object, Object)
Matrix.GetSize(Object)
Matrix.GetVectorMagnitude()
Matrix.InvertSquare(Object)
Matrix.IsEqualSize(Object)
Matrix.IsNearlyEqual(Object, Object)
Matrix.Power(Object)
Matrix.Scale(Object)
Matrix.SetRC(Object, Object, Object)
Matrix.SortByColAsc(Object)
Matrix.TransposeSquare()
Matrix.Average
Matrix.Cols
Matrix.IsEmpty
Matrix.IsSquare
Matrix.IsVector
Matrix.Length
Matrix.MaxVal
Matrix.MinVal
Matrix.Rows
Matrix.Sum
Namespace: PlcDocu.TcMatrix
Assembly: TcMatrixConnector.dll
Syntax
public abstract class MatrixAccessor : Matrix

Fields

| Improve this Doc View Source

M_

Declaration
public Matrix M_
Field Value
Type Description
Matrix

Methods

| Improve this Doc View Source

GetI(Object)

Gets the value of the element in this matrix at the supplied location as if the elements were stored in a 1D row-major array Prerequisites:

  • I < Rows*Cols
  • Matrix is not empty
note

If the supplied index is out of bounds the value 0 is returned and a warning is generated in the Error List

Declaration
[IgnoreReflection]
public dynamic GetI(dynamic I)
Parameters
Type Name Description
System.Object I

The index of the element which should have its value returned

Returns
Type Description
System.Object

The value of the element at the specified index, or 0 if an invalid index is supplied

| Improve this Doc View Source

SetI(Object, Object)

Sets the element specified BY the supplied index TO the suppleid value, assuming the data OF the matrix is stored in a 1D row-major ARRAY Prerequisites: - I < Rows*Cols

Declaration
[IgnoreReflection]
public dynamic SetI(dynamic I, dynamic Val)
Parameters
Type Name Description
System.Object I

The index specifying which element should be modified

System.Object Val

The value copied to the corresponding element

Returns
Type Description
System.Object

TRUE if the specified index is valid and the data is copied. FLASE otherwise

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX