From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-26-2012 02:16 PM
Hi Friends,
I'm having difficulting in setting a range of numbers for each row in a 2D array. The description of the program is listed below:
A VI that outputs a 2D array with 10 rows and 5 columns. The first row should contain five random numbers in the range 0 to 1, second row numbers in the range 1-2..and so on to the tenth row, which should contain five random numbers in the range 9-10.
I've attached my program what I've worked out.
11-26-2012 02:26 PM
One fairly straightforward approach
11-26-2012 02:26 PM
To create a range of random numbers, it is rand*(max-min)+min. Make a subVI that does this calculation. All you have to do then is put this new subVI into 2 FOR loop, autoindex out, and you have a 2D array.
11-26-2012 03:02 PM
yes, I've done this part. I've included the VI in my post.
I want the first row in the 2D array to range random numbers from 0 to 1
the second row to range random numbers from 1 to 2
the third row to range random numbers from 2 to 3
the fourth row to range random numbers from 3 to 4
the fifth row to range random numbers from 4 to 5
the sixth row to range random numbers from 5 to 6
the seventh row to range random numbers from 6 to 7
the eighth row to range random numbers from 7 to 8
the ninth row to range random numbers from 8 to 9
and lastly, the tenth row to range random numbers from 9 to 10
11-26-2012 03:04 PM
I'm not getting you...shouldn't there be iniial value for max and min to do the sub-vi
11-26-2012 03:16 PM
@Shalins wrote:
I'm not getting you...shouldn't there be iniial value for max and min to do the sub-vi
Take another look at the snipett I posted earlier
11-26-2012 03:33 PM
I tried your idea and this is what I have 🙂
11-26-2012 03:47 PM
Try that again
Withou the odd display formating
11-26-2012 04:04 PM
where do I get the array from on the block diagram like in the pic you posted.
11-26-2012 06:33 PM
@Shalins wrote:
where do I get the array from on the block diagram like in the pic you posted.
After running the VI, he right-clicked on the output wire and selected "create constant".