04-29-2019 02:19 AM
04-29-2019 02:38 AM - edited 04-29-2019 02:39 AM
Hi Saadiq,
why don't you use the well-known Euclidian algorithm?
(Why do you need to use such a large font? And why do you write LabVIEW wrong - two times?)
04-29-2019 02:52 AM
And why would you want to do that (, except for doing a homework assignment)?
If you open the GCD VI, you see how it's done. Spoiler alert: once you've seen it, it's going to be hard to can come up with an original idea.
04-29-2019 08:36 AM
Thank you so much for your input, but most VI codes that I see out there use a GCD function or at least appear to.
I am new to LabVIEW so comprehending the way it works in a short period of time is daunting but doable.
I need to see an example that does not involve a GCD function of any kind, just pure arithmetic to find a GCD.
Pointing me in the right direction would be greatly appreciated!
Thanks again!
04-29-2019 08:38 AM
One of the nice things about Numbers and Math is that with Pencil and Paper and some experimentation, you can often "figure things out for yourself". Of course, you need to understand what "Greatest Common Divisor" means ...
So what is the GCD of 3 and 6? of 4 and 6? of 5 and 6? of 8 and 28? of 26 and 78? There are multiple ways (including Euclid's Algorithm) to solve these, and once you have an algorithm, just program it in LabVIEW, doing the same (sequential) steps repetetively until you reach a "stopping criterion" that signals you have the answer. It may not be "the fastest", or the "neatest", but doing it for yourself will teach you some LabVIEW and give you a sense of accomplishment.
Bob Schor
04-30-2019 04:04 AM
@Saadiq9 wrote:
Thank you so much for your input, but most VI codes that I see out there use a GCD function or at least appear to.
I am new to LabVIEW so comprehending the way it works in a short period of time is daunting but doable.
I need to see an example that does not involve a GCD function of any kind, just pure arithmetic to find a GCD.
Pointing me in the right direction would be greatly appreciated!
In a new VI diagram, Quick Drop (CTRL+space) and type GCD. Pick GCD.vi.
That's not technically a function, it's a VI shipped with LabVIEW. It has pure math in it...
04-30-2019 07:11 AM
wiebe@CARYA wrote:
@Saadiq9 wrote:
Thank you so much for your input, but most VI codes that I see out there use a GCD function or at least appear to.
I am new to LabVIEW so comprehending the way it works in a short period of time is daunting but doable.
I need to see an example that does not involve a GCD function of any kind, just pure arithmetic to find a GCD.
Pointing me in the right direction would be greatly appreciated!
In a new VI diagram, Quick Drop (CTRL+space) and type GCD. Pick GCD.vi.
That's not technically a function, it's a VI shipped with LabVIEW. It has pure math in it...
But that's precisely what he asked you not to do! If you play a little with pencil and paper (and maybe remember learning fractions in elementary school), you should be able to find the GCD of two numbers, and if you think about the steps you took, you could write down the LabVIEW code to do this. It may be inefficient, it may be sub-optimal, but it should work and will teach you how to take a problem, break it down into two smaller problems that each can be solved, and thereby allow you to "converge to the answer". All without looking at someone else's solution, which deprives you of a "chance to learn" ...
Bob Schor
04-30-2019 09:11 AM
The GCD function doesn't use the GCD function
. It does show how to make a GCD with 'math only' primitives.
I wander about the usefulness of this all... I agree: if OP wants a learning experience, then Wikipedia and a piece of paper are the way to go.