LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search two different elements from excel

Solved!
Go to solution

Hi all,

 

I have an excel file and its consists of Freq, DOA, Voltage-1, 2, 3 & 4.

Freq & DOA are the inputs to find out the voltages. But here one frequency corresponding to set of DOA Values. That means Both the values (Freq & DOA) are repeating in the excel.

For more clarity please find the enclosed excel sheet.

If it is not repeating means we can easily search but here the value are repeating and i am not able to match the both row indexs.

Please provide the solution for this case.

 

Thanks & Regards,

Nagaraju

0 Kudos
Message 1 of 13
(3,997 Views)

Please show us what you've tried. Are you using the Report Generation Toolkit or plain ActiveX?

 

Ben64

0 Kudos
Message 2 of 13
(3,979 Views)
Solution
Accepted by Sonti_11532

Your data consist of 6 columns arranged as one Header row and multiple "Data" rows, where all of the data are numbers (integers, in fact).

 

You can easily read everything from Row 2 on into a 2D Array.  To simplify the sorting and searching you'd need to do, I would advocate created a Cluster of 6 I32s (or Dbls), called Freq, DOA, Chan 1, Chan 2, Chan 3, and Chan 4, then (in a For Loop), make it a TypeDef ("My Data") and change the 2D array of I32s into a 1D Array of My Data.

 

Now your problem simplifies easily -- given a pair of Freq and DOA, locate the My Data record that matches and return the four Chan X values.

 

The solution to the first part (reading the Worksheet) has been covered numerous times, and there are Examples, I believe, in LabVIEW.  If you get stuck, post your code (as VIs, please) and we'll help.

 

Bob Schor

0 Kudos
Message 3 of 13
(3,964 Views)

Dear sir,

 

I followed your suggested approach. But I didn't understand “change the 2D array of I32s into a 1D Array of My Data”.

Here I am attaching the VI what I tired.

Kindly help for solution.

 

Thanks,

S Nagaraju

Download All
Message 4 of 13
(3,933 Views)

Dear ben64,

 

I am using Report Generation Toolkit.

Please find the enclosed VI which I tried initially and it is searching upto first match after that stopping.

 

Thanks,

S Nagaraju

0 Kudos
Message 5 of 13
(3,920 Views)
Solution
Accepted by Sonti_11532

HI Nagaraju,

 

The way Ben told is also a good idea to implement. You can also try sequential searching which means first search the frequency and use that index ass offset and search for the DOA. It should help you out.

Regards,
Yaskadeva
India AE
National Instruments, India

There are only two ways to tell somebody thanks: Kudos and Marked Solutions 😛
0 Kudos
Message 6 of 13
(3,865 Views)

@parkalaae wrote:

HI Nagaraju,

 

The way Ben told is also a good idea to implement. You can also try sequential searching which means first search the frequency and use that index ass offset and search for the DOA. It should help you out.


I guess you're talking about Bob's idea.

 

Ben64

0 Kudos
Message 7 of 13
(3,845 Views)
Solution
Accepted by Sonti_11532

You need to iterate throught the 2D array to match both values.

 

Two Elements Match.png

 

Ben64

Message 8 of 13
(3,829 Views)

Thank you very much for the replay.

0 Kudos
Message 9 of 13
(3,806 Views)

Hi @ben64, could you please give me a vi file. Thanks

0 Kudos
Message 10 of 13
(2,891 Views)