LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subtracting 2d arrays into 1d array

Solved!
Go to solution

Hi everyone,

 

So I'm having a different issue now with subtracting 2d arrays into 1d array.  I'd like to subtract each row and output the result as a 1d array.  Anyone have any ideas?  I'd tried to look elsewhere but the info online doesn't seem to work for me.  Such as:

 

http://forums.ni.com/t5/LabVIEW/Subtract-2D-array-elements-and-insert-the-result-into-a-new-row/td-p...

 

I'm only interesting in outputing the result as a 1d array and do not care about keeping the original 2d array.  For example:

 

2D array:

 

1  2 

5  2

6  4

 

Result:

 

-1

3

2

 

Thanks!

 

Jon

0 Kudos
Message 1 of 12
(3,621 Views)

Use a FOR loop to get each row of the 2D array. Subtract the elements.

 

Show what you have done with a VI.

 

 

0 Kudos
Message 2 of 12
(3,618 Views)

Hey nyc,

 

I've already put it into a for loop but I get the a total of two cell result where instead I should be getting much more than that depending on the sample points taken.  I've attached what I've tried to do but obviously it's wrong.  thanks.

 

Jon

0 Kudos
Message 3 of 12
(3,609 Views)

Here's the image.

0 Kudos
Message 4 of 12
(3,608 Views)

Indexing array and then subtractiong the rows is the easiest way.



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 5 of 12
(3,606 Views)

@odessy27 wrote:

Indexing array and then subtractiong the rows is the easiest way.


Close, but you need to index out the colums.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 12
(3,597 Views)

Thanks Odessy27,

 

I've tried using this index array before with index(row) and index(column) but for some reason my 2011 labview doesn't recognize this and automatically changes it to index without the 'row' and 'column' info.  I've even tried to copy and paste it onto my labview and changes it back once I connect the lines.  It's definitely a 2d array so I don't know what I'm not doing right.  I'm sure I've overlooked something but not sure how I can tell the index array only to subtract from the rows.  Thanks.


Jon

0 Kudos
Message 7 of 12
(3,592 Views)
Solution
Accepted by topic author JonRod

Are you indexing the 2D array itself or are you indexing inside a for loop with autoindexing?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 12
(3,581 Views)

Hi again Crossrulz,

 

I'm indexing it inside a for loop and iterating it depending on the number of elements.  Here's the image.

 

 

0 Kudos
Message 9 of 12
(3,575 Views)

Sorry for the unconnected wire from the iteration from the index array but it's supposed to be wired.

0 Kudos
Message 10 of 12
(3,574 Views)