03-18-2011 10:30 PM
Hi Guys, I need some help.
I want to increase and then decrease a number continuously.
for example: 0,1,2,3,4.....179,180, 179, 178,...3,2,1,0,1,2,3....179,180, etc..
Any ideas??
Regards!
Sam
Solved! Go to Solution.
03-18-2011 11:11 PM
Please find attached TWO DIFFERENT solution in LV8.6.
Kudos are welcomed.:-)
03-19-2011 12:49 AM
03-19-2011 12:52 AM
What is that little box with Boolean text within?
I approach my mouse with the helper activated and says anything.
Regards,
03-19-2011 12:56 AM
It is called "local variable".Available by right clicking control or indicator.
It is used to read or write the value to control or indicatro any where in the VI, multiple times.
Its like pointer of C lang.
03-19-2011 01:09 AM - edited 03-19-2011 01:09 AM
Here's another way (LabVIEW 8.2).
(of course you don't really need a chart, so replace it with a plain numeric indicator)
03-19-2011 01:20 AM - edited 03-19-2011 01:22 AM
Your method will work but there is small issue to be notified.
Since you are creating an array of 0 to 180 & 180 to 0, you are unnecessarily allocating the memory for these additional 360 nos. Its very small memory but still not an optimized & efficient code. User wants only one output & not an array I believe, so why to have chart to allocate more memory???
Why to waste precious memory???
03-19-2011 01:30 AM - edited 03-19-2011 01:33 AM
@kekin wrote:
Why to waste precious memory???
Compared to anything else, the memory use here is insignificant. Even megabytes of data are no problem. The array is folded, meaning it is calculated at compile time and internally replaced with a diagram constant. Indexing a fixed size array is very efficient, meaning the code in the loop is significantly more efficient than hadling all these case structures and comparisons with every iteration.
The average computer has GBytes of RAM. The data structures here are a million times smaller. Insignificant!
If memory is really an issue, you can make it 4x smaller by changing the representation to U8 inside the FOR loop.
Just for fun, here's another solution that does not use arrays, case structures, or comparisons. 😄