04-06-2020 05:44 AM
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!
04-06-2020 07:43 AM
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?
04-06-2020 08:19 AM
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)
04-06-2020 08:40 AM
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.