Skip to content

Array Of Struct Example #6

Open

Description

@OWarneke

It is possible to declare Arrays of Struct by combining the UserArray and UserStruct example.
You have to carefully calculate the length of your struct.

ArrayAttribute = the Dimensions! not the number of elements (at the moment only 1 Dimension allowed)
ArrayDimensionAttribute = Sets

  1. Define a Structure "YourStruct" (with structureAttribute)
  2. Create Array after the UserArray Pattern of Type "YourStruct"

Please add an example for this usecase.

Activity

  1. martinboers commented on Nov 30, 2022

    @martinboers
    Member

    The User Array example now shows how to use an Arrays of Structs as an Input parameter on a function block, however it is not clear how to use an Array of Structs as an Output parameter.

    Using the current example, it's not possible to directly write to elements of structs in an array, as is required for Output parameters. Instead, pointers must be used. This example copies each struct element from an input array of structs (arrPara) to an output array of structs (arrOutput):

    image

    It would be great to include a case like this in the example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions