I'm trying to generate a data list, introducing values to a variable, and after obtain the number of data list and their values. For example, if we introduce values for X = 100, 200 and 300, we want get "Number of data = 3 and values x1=100, x2=200 and x3=300"
I know that's a simple question, but I need a clear solution to continue with simple macros.
Thanks
Generate a data list
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
So you want:
- An array of numbers
- A function which returns the first n elements of the array
Correct?
Before I write code I want to be clear on what you are asking for.
- An array of numbers
- A function which returns the first n elements of the array
Correct?
Before I write code I want to be clear on what you are asking for.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
This is just an example. It creates an array of numbers from 100-1000 stepped by 100. It then asks the user how many numbers you want to retrieve and returns that many from the top of the array and displays in a string.
Code: Select all
//Create an array of numbers 100 to 1000 step by 100
Let>thenumber=0
Let>index=0
Repeat>index
Let>index=index+1
Let>thenumber=thenumber+100
Let>MyArray_%index%=thenumber
Until>index=100
//Ask user how many numbers you want to get
Input>num,Enter how many numbers you want to return:
Let>x=0
Let>myString=
Repeat>x
Let>x=x+1
Let>this_number=MyArray_%x%
Let>myString=%myString% x%x%=%this_number%;
Until>x=num
MessageModal>myString
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?