-
FlexPro
- At a Glance
- Features & Options
- Applications
- All Advantages
- What’s New in FlexPro 2021
- Try FlexPro For Free
- FlexPro View OEM Freeware
- Buying Guide
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
- Products
- News
- Support
- Company
- Contact
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
Home > Community > FPScript > Arrays und Schleifen > Reply To: Arrays und Schleifen
February 20, 2009 at 11:41 pm
#8780
Bernhard Kantz
Participant
First you should be aware that each formula can return only one result (besides if you are using a list result).
The shortest way to solve the first issue is something like this (we assume that all datasets have the same length):
Result = TransposeMatrix({ Dataset1, Dataset2, Dataset3})
The result can than be found in Result[0], Result[1] and Result[2]. If you only need a specific index you could proceed like this:
Create a new formula called ‘DataSetFromIndex’:
Arguments Datasets, Idx
Dim MaxLen, Result
// To simplify things we assume that all datasets have the same length
MaxLen = NumberOfRows($Datasets[0]$)
// pre-allocate the result
Result = 0. # NumberOfRows(Datasets)
For Each Row i In Datasets Do
Result = ($Datasets$)[Idx]
end
Result
Then call it from another formula like this (for the index 1):
DatasetFromIndex({ "Dataset1", "Dataset2", "Dataset3" }, 1)
The second issue could be solved like this (assume Sig for your Signal, to avoid name clashes with the built-in function Signal):
Signal(Dataset1, Sig[0] # NumberOfRows(Dataset1))
Signal(Dataset2, Sig[1] # NumberOfRows(Dataset2))
...
Support
support@weisang.com