LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Peak value of histogram used to find corresponding values in original data

Hi
I have made a vi called histo_Rev_011.vi that takes the input from the .txt file (of a data which was initially in excel format but copy pasted into the txt file). This data is plotted as a histogram.

I need the histograms (2nd chart) maximum value (not which occurs in the very beginning of the 2nd graph) but the value which occurs in the center of the graph between the points 10,000 and 20,000. In the current graph it occurs around the 15,000 mark on the x axis. I need to find this value and a solution which will enable me to select this max value between a given range in the histogram graph (like in this case say give me the option to select 10,000 and 20,000). This val
ue from the x axis of histogram is located on the y axis of the first graph. If an imaginary perpendicular is dropped to this y axis it shall cut the graph at n number (this n is the value on the y axis on the second graph) of points. I want these corresponding values on the x aixs of these n number of points.


There are two more buttons in which the user enters the max (55257) and min (-111) values from the original waveform. The bin size is to be kept at 512 (since the number of data points are 512).

I am sending my vi file
histo_Rev_011.vi, the txt file hd2.txt, as well as its excel counterpart hd2.xls.

hd2.xls � this is the excel file whose data is plotted as a histogram.

hd2.txt � this is the txt form of the above excel file


Please respond...
Download All
0 Kudos
Message 1 of 29
(5,420 Views)
The text file has some characters that the Read from Spreadsheet VI does not interpret as part of a numeric. The first few lines of the file contain:

512\t\r"498.04455,"\t220\r"498.77056,"\t165\r"499.49657,"\t258\r"500.22258,"\t202\r"500.94859,"\t147\r"501.67459,"\t202\r

Where \t represents a tab and \r represents a carriage return. The " ," characters prevent the spreadsheet VIs from interpreting your data correctly. I used the Match Pattern VI to find the " characters and was able to recover the data. Because the first line does not have quotes, an extra test is required.

I am attaching a simple VI which reads the file as a string and then sorts into arrays.

Lynn
0 Kudos
Message 2 of 29
(5,416 Views)
I have LabVIEW version 7 so please could you resend the file by saving it as a version 7 file instead of the current 7.1 version.

Thanks for your help
0 Kudos
Message 3 of 29
(5,416 Views)
Here it is for version 7.0
0 Kudos
Message 4 of 29
(5,416 Views)
Hi
Since I have a lot of data I cannot convert those files to remove the commas and tabs so if I use the read from spreadsheet function and insert text file the data is read properly which is shown in the top graph of the histo_Rev_011.vi.

The vi file which you sent sorts the array 3 but in array 2 it shows just the first value of the array with rest all zeros.

Could you either update the histo_Rev_011.vi or maybe help me out to find the peak of the histogram as explained earlier between 10,000 and 20,000 and find the corresponding value of intensity which should enable us to find the respective values of wavelength (x axis of first graph) from the first graph. [Details available in the original question, so not posting it aga
in]

Thanks
0 Kudos
Message 5 of 29
(5,416 Views)
Hi,

In your VIs, the second graph was not showing the correct X-axis. Please see the attached modified VI that shows the correct graph. Basically I created the corresponding x-axis data for the histogram data and plotted it on a waveform graph.

To find the peak value in the histogram in between certain range of intensity values you would need to do lot of array manipulation (the attached VI would give you some insight on how to do it).

Please let me know if you have more questions.

Regards,
Ankita A.
National Instruments
0 Kudos
Message 6 of 29
(5,416 Views)
I have LabVIEW version 7 so please could you resend the file by saving it as a version 7 file instead of the current 7.1 version.

Thanks for your help.
0 Kudos
Message 7 of 29
(5,416 Views)
Hi,

Here is the VI in version 7.0. Please let me know if you have any more questions regarding this issue.

Regards,
Ankita A.
0 Kudos
Message 8 of 29
(5,416 Views)
Hi
The VI, which you sent, did solve a part of my question. Thanks a lot on that. But I still need help to find the values on x axis in the first graph (labeled as Original Waveform) corresponding to the value obtained in "Intensity corresponding to peak value between Max and Min Intensities specified" . I calculated its values through excel in the mean time. In this case it would look like

582.9876 14880
585.89164 14887
587.34366 14889
588.06966 14815
588.79567 14880
589.52168 14871
590.9737 14890
591.69971 14889
592.42572 14913
593.15173 14889
596.05576 14825
597.50778 14848
604.04186 14817
605.49388 14
815
612.02796 14882
612.75397 14871

Hope I explained sufficiently enough to get my point through.

I am also attaching the excel file which enabled me to do this calculation in a manual manner. Though it might not be of much help, but I am sending it along though.
Thanks
0 Kudos
Message 9 of 29
(5,416 Views)
Hi,

To find the value of wavelength corresponding to a particular intensityy, follow these steps.

1. Use Search 1D array function to search the Intensity array for the particular intensity. This function would return an index value.

2. Use the Index Array function with the wavelength array to find out the value of wavelength occurring at the index returned by step 1.

Regards,
Ankita A.
National Instruments
0 Kudos
Message 10 of 29
(5,416 Views)