Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array Of Struct Example #6

Open
OWarneke opened this issue Dec 8, 2020 · 1 comment
Open

Array Of Struct Example #6

OWarneke opened this issue Dec 8, 2020 · 1 comment
Labels
feature-request New feature or request

Comments

@OWarneke
Copy link
Member

OWarneke commented Dec 8, 2020

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.

@OWarneke OWarneke added the feature-request New feature or request label Dec 8, 2020
@martinboers
Copy link
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
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants