Jump to content

LabView array manipulation!


Siri

Recommended Posts

Hello everyone!!

Im new to labview.. so i hav heaps of questions.

I hav a 2D array and I need to add another 1D array to all the rows of this 2D array.

Note: the no of colums of the 1D array and 2D array are the same.

I tried using the index array function inside a for loop.. but it does not fetch one row at a time.. so Im kinda stuck.. need help :(

THanks in advance :)

Link to comment

Siri,

I think you are asking to take every row in Array A and add Array B to get a row in Array C with that row defined as C1 = A1 + B1....Cn = An + Bn.

If this is the case:

One of the most straight-forward ways to do is to put Array A and B outside of a For loop (do not wire anything to the "N" of the loop).

Wire A and B to the left edge of the loop. Right click each "tunnel" and select "Enable Indexing" for Array A and "Disable Indexing" for array B.

Inside the loop use the numeric "add" for the two inputs and wire the output to the right edge of the loop.

Select "Enable Indexing" to the output, create an indicator outside the loop and see the results!

Have fun,

Link to comment

QUOTE (Jolt @ Apr 10 2009, 07:31 AM)

One of the most straight-forward ways to do is to put Array A and B outside of a For loop (do not wire anything to the "N" of the loop).

Wire A and B to the left edge of the loop. Right click each "tunnel" and select "Enable Indexing" for Array A and "Disable Indexing" for array B.

Inside the loop use the numeric "add" for the two inputs and wire the output to the right edge of the loop.

Select "Enable Indexing" to the output, creat a indicator outside the loop and see the results!

Actually, you don't need the for loop at all: just use Index Array to separate Array A and Array B then use the Add primitive to add Array C to either of them.

Link to comment

QUOTE (asbo @ Apr 10 2009, 08:13 AM)

Actually, you don't need the for loop at all: just use Index Array to separate Array A and Array B then use the Add primitive to add Array C to either of them.

asbo may be correct, it depends on what exactly you are trying to do -

The loop in the answer above is only necessary if you are trying to add a 1-d "Array B" to every row of 2-D "Array A." There are, of course, many other ways to do this very thing but the auto-indexing For loop is a good place to start. The indexed loop also allows any number of rows in Array A - all will be processed.

If none of these answers make sense please clarify the behavior you are looking for...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.