09-21-2005 04:08 PM
09-21-2005 04:12 PM
09-21-2005 04:45 PM
09-21-2005 05:26 PM
09-21-2005 06:04 PM
Do yourself a favor and just use "array min/max" from the array palette. It's not worth dealing with dynamic data types in this simple case.
Now simply accumulate your array max (scalar) into an array via a shift register and a "built array" node (Array indicator will be updated at each iteration) or use autoindexing (array indicator will be updated once the loop finishes). The attached modified sample (LabVIEW 7.1) shows both methods.
Also, since this is a toplevel while loop, it should propably contain a small wait statement.
09-22-2005 07:44 AM
Thanks for both examples. I'll spend a lot of time chewing on them today.
I didn't mention that I have 22 years experience programming in various flavors of BASIC and VB through VB6, but this is my first forray into working with instruments. Even though I've completed the LabView Basics 1 & 2 courses, I've had a bit of trouble grasping how loops work in LV compared to VB, but even more so with arrays. Arrays in VB are comparatively simple, so I appreciate the insights you've shared.
I bailed out of LV and built the application in VB6 that needed the general array manipulation I asked about. It took a fraction of the time that I wrestled with this in LV. But I couldn't stand not knowing where I went wrong. I will definitely need a grasp of arrays in the future to use LV. (I could use a couse just in LV arrays beyond those tutorial samples that came with the Pro development suite.)
09-22-2005 11:24 AM
09-22-2005 02:01 PM
"Easier" is a matter of experience and, as you pointed out, understanding. I checked my VB6 code and found it took only 20 lines of code to accomplish what I needed without any consideration to "scalar" data or shift registers. No WHILE loops and one of the For/Next loop starts at 21 and counts to 40 (still don't know how to do that in LV).
I started with a printout of a 1987 Japanese DOS BASIC program written on an ancient NEC PC system; a good 50% percent or more that code has no direct usage in VB6. Within a week I had "translated" the code into a complete VB application.
Two weeks trying to just get the data to do what I needed with LV left me feeling like a complete idiot.
But I realize that it is a lack of experience AND understanding. When I can think as well in LV as VB, perhaps I'll be as productive. Who knows?![]()
09-22-2005 02:47 PM
Twenty lines of code seem like at lot
. Seriously, many of us started with text based languages and the transition was difficult at the beginning but now, LabVIEW coding seems natural and when I have to do anything in C or C++, I feel burdened down.
By the way, one way to do your for loop in LabVIEW is shown in the attachment.
09-22-2005 03:13 PM