09-01-2010 10:32 AM
I have grabbed data from file and have used decimate 1 D array to pull out the elements I needed and have calculated a value in a while loop as I am indexing through the incoming data. Now I need to form an output array of the calculated values. In C this is easy. You just assign a value to the element in the new array. Can not seem to be able to figure this out.
09-01-2010 10:44 AM - edited 09-01-2010 10:46 AM
It's easier in LabVIEW. Instead of a while loop, wire the array into a for loop. Do the calculation inside the loop and pass the value out. Auto-indexing will create your output array. No indexing required at all.
Have you taken the time to take the LabVIEW 101 tutorial? If not, it would be highly advised to do so.
09-01-2010 11:41 AM
It looked simple but when I tried it all of the arrays lost a dimension going in and gained a dimension leaving. What gives?
09-01-2010 12:04 PM
@ITElearner wrote:
It looked simple but when I tried it all of the arrays lost a dimension going in and gained a dimension leaving. What gives?
The arrays are indexed going into and out of a loop structure. That is the normal and expected behavior. You can disable indexing by right-clicking on the tunnels if you want to handle the indexing manually.
09-01-2010 12:07 PM
Hi ITE,
"the arrays lost a dimension going in and gained a dimension leaving"
That's the concept of auto-indexing! You feed a 1D-array to the loop, in the loop you process the single items and after the loop you get your processed array back...
You said you want to calc on the single elements...
09-01-2010 12:15 PM
If you're doing the same calculation on every element you likely won't need the loop at all.
09-01-2010 01:48 PM
I have used a while loop because of what calcultions I was doing. The concept I had to learn was setting the tunnels to shift register.(not very intuitive) I can see the use of the for loop for some other applications and will try to remember the advantages.
Thanks for the feedback.
09-01-2010 01:56 PM
@ITElearner wrote:
The concept I had to learn was setting the tunnels to shift register.(not very intuitive)
That's where the tutorials and LabVIEW basics courses come in handy. To learn the things that you wouldn't have thought of otherwise.
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours