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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you state the range for each row?

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.

0 Kudos
Message 1 of 19
(2,718 Views)

1!.PNG

One fairly straightforward approach


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 19
(2,715 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 19
(2,714 Views)

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

0 Kudos
Message 4 of 19
(2,703 Views)

I'm not getting you...shouldn't there be iniial value for max and min to do the sub-vi

0 Kudos
Message 5 of 19
(2,701 Views)

@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 earlierSmiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 19
(2,698 Views)

I tried your idea and this is what I have 🙂

0 Kudos
Message 7 of 19
(2,694 Views)

Try that again

1!.PNG

 

Withou the odd display formating


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 19
(2,686 Views)

where do I get the array from on the block diagram like in the pic you posted.

0 Kudos
Message 9 of 19
(2,681 Views)

@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".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 10 of 19
(2,663 Views)