08-07-2012 09:03 AM
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:
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
Solved! Go to Solution.
08-07-2012 09:06 AM
Use a FOR loop to get each row of the 2D array. Subtract the elements.
Show what you have done with a VI.
08-07-2012 09:16 AM
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
08-07-2012 09:16 AM
Here's the image.
08-07-2012 09:18 AM
Indexing array and then subtractiong the rows is the easiest way.
08-07-2012 09:26 AM - edited 08-07-2012 09:26 AM
@odessy27 wrote:
Indexing array and then subtractiong the rows is the easiest way.
Close, but you need to index out the colums.
08-07-2012 09:31 AM
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
08-07-2012 09:43 AM
Are you indexing the 2D array itself or are you indexing inside a for loop with autoindexing?
08-07-2012 09:48 AM
Hi again Crossrulz,
I'm indexing it inside a for loop and iterating it depending on the number of elements. Here's the image.
08-07-2012 09:49 AM
Sorry for the unconnected wire from the iteration from the index array but it's supposed to be wired.