08-31-2006 07:18 PM
08-31-2006 08:18 PM - edited 08-31-2006 08:18 PM
Message Edited by altenbach on 08-31-2006 06:21 PM
09-01-2006 05:49 PM
09-01-2006 06:50 PM - edited 09-01-2006 06:50 PM
PGH wrote: The problem was that I use the array-to-cluster function as a short-cut to getting each array element. If the array has fewer elements than the cluster output, then on a PC, labview always outputs a zero. However on a Mac, it initially outputs a zero, but if the array grows to that size, then shrinks again, it outputs garbage.
Well, first of all, that's not a shortcut, but a detour. (Even worse, you unbundle the same old stuff with every single loop iteration instead of only once before the loop). :o. A single expanded "index array" node will do the same just fine, you don't even need to wire the indices (see attached).
I agree that the MAC behavior is not right. Please file a bug report with NI or at least put small note and a link to this thread in the bug thread.
(I don't have a MAC, so I cannot verify the problem).
PGH wrote: Your (i.e. altenbach's) "fixed" version is fine, and it helped me figure things out, but for other reasons I had to reconstruct the polynomial curve in this way.
There are many ways to calculate a polynomial and the formula node is probably the worst. For fun I did a few alternatives and they all automatically adjust to the polynomial order used. (The "expicit loop" version can easily be modified to e.g. omit higher orders by wriring the N of the loop to a lower number). They all give the same result. 😉 (see attached)
Note that your formula loop iterates once per X value, while my loop iterates once per coefficient.
Message Edited by altenbach on 09-01-2006 04:54 PM
09-01-2006 07:28 PM
09-01-2006 07:58 PM
@PGH wrote:
Why do you say "There are many ways to calculate a polynomial and the formula node is probably the worst."? Is it less accurate? The various ways you show are interesting, but I don't see why one would necessarily pick one method over another... Unless being able to handle an arbitrary order polynomial is necessary, in which case the formula node way fails.
As an aside, I have long wondered about how carefully National is about parsing the text inside a formula node. I have noticed, for example, that within a formula node, data types are not always what they seem (e.g. I16 vs I32, extended precision...).
Well, I simply don't like the formula node. 🙂 Compared to wires, It is clumsy and you cannot really debug (=place a probe or breakpoint) inside it. A simple spelling or syntax error easily breaks the entire thing and the mistake might be difficult to find.
Once you get the hang of it, wires are so much nicer. 😄 For example see how my loop automatically operates on the entire X array at once.
For seasoned C programmers, the presence of the formula node hinders the transition to "real" LabVIEW programming and they thus tend to miss out on the beauty, simplicity and power of dataflow.
Others may have different opinions, the above are mine.
The accuracy of the formula node is the same and you can define datatypes inside the formula node. You can even work on arrays directly.
10-18-2006 10:04 PM