It looks like every DataExchangeN in your code means different DataExchange. I have only 1 DataExchange and hundreds of variables with different datatype in this DataExchange. So what I want is likely Collection[0] point to DataRead.Data1, Collection[1] point to DataRead.Data2, .. Collection[N] point to DataRead.DataN+1. I will try if pointer can do this, thanks.
Hi aliazzz. Actually I have hundreds of elements with different datatype in the struct, which means there are Data1 .. Data1000(or more). The names of element are illustrative, actually they are irregular. I have only 1 DataExchange named DataRead, and I want to use index as parameter to call the element I need. For example, when I want to call Data50, I may use index 50 to call this element, instead of using DataRead.Data50. But I have no idea how to implement it. Sorry for my bad statement and...
Hi aliazzz. Actually I have hundreds of elements with different datatype in the struct DataExchange, which means there are Data1 .. Data1000(or more). The names of element are illustrative, actually they are irregular. I have only 1 DataExchange named DataRead, and I want to use index as parameter to call the element I need. For example, when I want to call Data50, I may use index 50 to call this element, instead of using DataRead.Data50. But I have no idea how to implement it. Sorry for my bad statement...
Hi, I have a struct with elements in different datatype, for example: TYPE DataExchange : STRUCT Data1 : INT; Data2 : WORD; Data3 : DWORD; END_STRUCT END_TYPE VAR DataRead : DataExchange; END_VAR Is there any way to use the elements in the struct via index? It means using DataRead[1] := 0 instead of DataRead.Data1 := 0, DataRead[2] := 0 instead of DateRead.Data2 := 0, etc. Thanks.
Hi, I have a struct with elements in different datatype, for example: TYPE DataExchange : STRUCT Data1 : INT; Data2 : WORD; Data3 : DWORD; END_STRUCT END_TYPE VAR DataRead : DataExchange; END_VAR Is there any way to use the elements in the struct via index? It means using DataRead[0] := 0 instead of DataRead.Data1 := 0, DataRead[1] := 0 instead of DateRead.Data2 := 0, etc. Thanks.