03-18-2020 11:41 AM
Hello to all
I would like a vi that opens the source file, in txt format for the moment, and generates a number of random copies.
Entering the number of questions and the number of answers I divided the questions and now I would like to assign them a random position in a array but the result isn't I want.
Do you have any advice?
03-18-2020 12:14 PM
@franbecks wrote:
Entering the number of questions and the number of answers I divided the questions and now I would like to assign them a random position in a array but the result isn't I want.
What is the result that you want?
03-18-2020 01:03 PM
I would the vi puts the question 1 (domanda 1), it has intial position 1, in a random position.
And I would repeat for all questions.
When I finished with the question I want randomize the answer, but this is another step.
03-18-2020 01:30 PM
I think that you don't want completely random, though. I'm guessing that you want to put question 1 in a random position, and then put question 2 randomly in one of the 3 remaining positions, and then put question 3 randomly in one of the 2 remaining positions, and then put question 4 in the final remaining position. Is this correct?
03-18-2020 01:54 PM
To get a row, use index array, not "delete from array".
What's the point of the numeric control?
In newer LabVIEW versions, you can use "shuffle 1D array", but you could easily write your own.
03-19-2020 04:51 AM
@johntrich1971 ha scritto:
I think that you don't want completely random, though. I'm guessing that you want to put question 1 in a random position, and then put question 2 randomly in one of the 3 remaining positions, and then put question 3 randomly in one of the 2 remaining positions, and then put question 4 in the final remaining position. Is this correct?
Yes, it's correct.
I generate a random pseudo position, this test has only 4 questions but I want the vi woks with a lot of questions.
I have changed, to extract the questions, delete array with index array to separate the questions and I use index array but doesn't work like I would.
Can you explain me why?
03-19-2020 07:44 AM
In the attached the first loop pulls the questions and the second loop randomizes them. Altenbach's suggestion to use Shuffle 1D Array is a better solution than the second loop, but I did the exercise to show you one way it could be done.
One suggestion that I would have is to go ahead and group your question and answers in the first loop (perhaps with a cluster containing a question and an array of answers). This will more readily allow you to put the in the proper order later.
03-19-2020 04:53 PM
@johntrich1971 ha scritto:
In the attached the first loop pulls the questions and the second loop randomizes them. Altenbach's suggestion to use Shuffle 1D Array is a better solution than the second loop, but I did the exercise to show you one way it could be done.
One suggestion that I would have is to go ahead and group your question and answers in the first loop (perhaps with a cluster containing a question and an array of answers). This will more readily allow you to put the in the proper order later.
Thank you, but there is a problem with you attached.
Please, you can send me.
03-19-2020 05:25 PM
Is the filename pointing correctly to your text file?
03-19-2020 06:01 PM
When I open the vi it searchs some library.
and when it doesn't found sends this pop up.
So,I open and modify the directory.