05-15-2018 08:39 PM
I have a 5x5 matrix full of 1-25 in order, but they ask me to look for the prime numbers that are inside it and to store them in another array, I could not do it
05-15-2018 08:20 PM
Tengo una matriz 5x5 llena de 1-25 en orden, pero me piden que busque los numeros primos que estan dentro de ella y los consigne en otro array, no he podido hacerlo
05-15-2018 08:58 PM
Since I don't have LabVIEW 2017, I can't directly comment on your homework problem. However, it seems to be to be designed to ask if you can do the following tasks:
I would think that if you read all of the tutorial material you can find on For loops, Arrays, and output tunnels, you should have no trouble with this assignment. If I do it for you, you won't learn anything.
Bob Schor
05-15-2018 09:17 PM
I send you the 2015 version, it did not really manage to just identify the prime numbers. I'm missing that from the exercise
05-15-2018 09:28 PM
05-16-2018 01:15 AM
Hi Daniavt,
I have a 5x5 matrix full of 1-25 in order,
You create an array. As a matrix is something different in LabVIEW please use the correct term "array" as well as array functions…
Hint: to make your live easier you could also use a 1D-array containing the number 1 to 25 and only reshape the array for UI display!
they ask me to look for the prime numbers that are inside it and to store them in another array,
Who is "they" and why did "they" ask you?
Hint: check each of those numbers for being prime (LabVIEW has a function for this!). Output only the primes into a new array.
I could not do it
What have you tried so far?
Did you develop an algorithm - on a sheet of paper?
Did you take the beginner lessons to learn LabVIEW? (Did you notice those tutorials mentioned in the header of this LabVIEW board?)
Did you take any "computer science" (aka programming) lessons at all?
Hints:
- Use a 1D array to hold your numbers.
- Use an autoindexing FOR loop.
- Use the "Check Prime" function.
- Use a conditional output tunnel of the FOR loop.
With those 4 hints your are (nearly) done with your task!
05-16-2018 10:27 AM
Follow GerdW's hints. If any step sounds "mysterious" to you, go back to the Tutorials, or read the Help descriptions from Array functions, or use Quick Drop (what's that, you ask? Do a Web Search) to find the function.
Give it a try. I would definitely start with a new, blank, VI and try to do things slowly, methodically, etc. I must confess I didn't see in the code you submitted any indication of progress towards solving this particular problem ...
Bob Schor
05-16-2018 10:42 AM
Looking at your code:
05-16-2018 12:41 PM
@Daninavt wrote:
I have a 5x5 matrix full of 1-25 in order, but they ask me to look for the prime numbers that are inside it and to store them in another array, I could not do it
So, what's the focus of this exercise? Is it about array manipulations or prime numbers?The answer will make a big difference here!
Yes, as has been said, LabVIEW now has the "check prime?" function, which is quite good. (Introduced in LabVIEW 2015). However, maybe you should roll your own, start with my 2016 NI Week talk. In one slide I compare many different ways to deal with prime numbers, so maybe you can learn something. The "dumb" algorithm is probably all you need :D)
I really have absolutely no idea what the purpose of all your numeric scalar controls are. They make no sense for this problem. Why are they even there?