LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combine 2D Arrays (And Sum Duplicate X Values)

I am very new to LabView, hoping to be able to use it to perform some data processing functions. 

 

I have a series of 2D Arrays, which I would like to combine to form a single 2D Array. However, when there is a duplicate X value, I would like it to display one X value in the new array and the sum of the two Y values. 

 

I have attached a clip of a excel spreadsheet which shows this visually. The example should show colour coordinated examples of what the intensity values would sum to where there are duplicated x values.

 

If anyone could help out, and possible explain what is happening at each stage of their code (and why!) that would be amazing help. As I said, I'm very new to LabView, so I want to understand the answer so I can progress!

0 Kudos
Message 1 of 4
(2,010 Views)

It would help if you told us how the inputs are provided. Arrays (for each spectrum) of clusters (Mass\Intensity) of arrays (for each value)? Or Arrays (for each spectrum) of clusters of arrays (for each value) of clusters (Mass\Intensity)?

 

I suspect someone will make a map solution. What version of LabVIEW are you using?

0 Kudos
Message 2 of 4
(1,972 Views)

Each mass spectrum is a 2D array (loaded from a csv file that I did not create) containing the peak masses and intensities of detected peaks. Column 0 is an array of peak masses. Column 1 is an array of peak intensities. Hope that helps?

 

I am using LabView Version 19.0.1f1 (32 bit)

0 Kudos
Message 3 of 4
(1,964 Views)

Do note that you are using floating points for the X axis.  So comparisons between them in order to add intensities will be problematic.  There are a ton of discussions about equal comparisons of floating points not working due to the nature of floating point math (it is inherit to the IEEE standard, not LabVIEW).  So when you loop through your values, you will want to be checking for "close enough" before adding values.


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 4 of 4
(1,960 Views)