LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How create basic test

Solved!
Go to solution

Hey, I'm newbe in LabView. How can I create basic test. Where I upload a file with questions. There are 300 questions. The program has to draw 10 random questions from the file and show them. At the moment I know how to load a file and show all questions in array. He added my file. Does anyone know how to do it? Thank you in advance for your help.

Download All
0 Kudos
Message 1 of 10
(3,142 Views)

Hi bury,

 

load all items, then select 10 of them in a loop.

To select random items you may create a ramp from 0 to (size of array -1), then apply Shuffle function, then just take the first 10 entries of the shuffled ramp as indices for your items...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 10
(3,118 Views)

Yes, I know how do it with hardcode data. But how do it with file data. Could you see the txt file and perform this task?

First I must upload data from file to array. What do I have to do in the next step? 

0 Kudos
Message 3 of 10
(3,113 Views)

Hi bury,

 

load the file using ReadText as an array of lines. Then do as written before...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(3,104 Views)
Solution
Accepted by Bury

Hi bury,

 

using LV2018 you can even apply Shuffle on your string array of items, so no need for an additional loop as I described before:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 10
(3,046 Views)

Wow, I will try this and let you know

0 Kudos
Message 6 of 10
(3,043 Views)

@Bury wrote:

How can I create basic test.


You would connect a pH electrode and see if the reading is >7. 😮

Message 7 of 10
(3,031 Views)

I will try this but I can't connect function. And why array subset isn't string format?

0 Kudos
Message 8 of 10
(2,983 Views)

Your question is unclear.  The VI you posted doesn't show you trying to connect any function and failing.  Nor does it show the Array Subset function.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 9 of 10
(2,967 Views)

Try this. And next, start your homework earlier. Create the VI yourself, you will learn something even if you just copy it exactly.

 

mcduff

 

snip.png

 

 

 

0 Kudos
Message 10 of 10
(2,964 Views)