Tip:
Highlight text to annotate it
X
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350 {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\fs24 \cf0 We've created arrays as an output. Now how do I go in and manipulate these elements
in the array? Well to do that, I can use them as an input. So, watch this. I'm going to
get rid of the number going into the count terminal, the random number generator, clean
up these, delete this, and be tricky, take this over here, right click on it, and change
it to a control.\ \
Now, I can wire from here into the For Loop. Before I do, take a look. I can't run this
yet because in the For Loop, N, or the count terminal, is not wired, and there are no Indexing
Inputs. Okay. Well, let's make an Indexing Input. There's my Auto-Index Tunnel, coming
inside, and a solid run arrow, so I can run it. How many times do you think it'll run?
Let's find out.\ \
I'll create an indicator off of the Iteration Terminal, and run it. Four. Did it run four
times? Well, no not really. It's zero-indexed, so if I run it, I can see - zero, one, two,
three, four. So counting that zero, this ran five times, which is the number of elements
in the array. So when I Auto-Index an input from an array, the loop runs once for each
element of the array. Can I disable indexing as before? \
\ You know it. I will click on Disable Indexing,
I'll get a solid tunnel. What am I taking in each time? Well, if I create an indicator
here, I can see that each time I'm running this, I'm taking a different value out of
this array, one by one, bringing each value in. \
\ So that can be helpful if I want to do something
like multiply each element in my array by a certain value. Maybe I multiply it by three.
Take that, and wire it to the border, Create an Indicator here, turn off 'Highlight Execution',
run it, and there's the same array with each element multiplied by three.\
\ Incidentally, those of you in the LabVIEW
know, will know that I could just use the polymorphism of the multiply function to wire
this array and scalar directly into here and have the array output. But don't spoil the
surprise.\ \
But if you're not sure what Polymorphism is, then take a look at it in the LabVIEW Help.
It's pretty important. Remember: polymorphism. You'll see it on the CLAD exam if you take
it, and you'll also see it in the Sixclear LabVIEW Fundamentals course. It's really good.\
\ Now, let's get rid of all this stuff, except
that label - SHIFT-click on it - delete the rest. Now, can I right click on this terminal,
as before, and Disable Indexing? Sure I can. I can't run my VI anymore because LabVIEW
doesn't know how often to run this loop, so I'd have to tell it, maybe five times, but
then what comes in each iteration? Well, it's the entire array. Why would I want the entire
array each time?\ \
Good question. A typical use case is to compare multiple elements in the same array together.
So, let's say I wanted to compare the 0-th element to the 1st element, or the 1st element
to the 2nd element, and so on. This is an easy way to do that. Of course there are other
ways to program that, but we're talking about auto-indexing and arrays here. Stay focused.
\ \
So far, I've kept it simple and done a 1D array. But how do I create and manipulate
a 2D array, or more? Or a higher dimension array? That's pretty easy too.}