# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Search two different elements from excel

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

Message 1 of 13
(2,160 Views)

## Re: Search two different elements from excel

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

Ben64

--------------------------------------------------
The best way to say thanks is to give kudos!
Message 2 of 13
(2,142 Views)
Solution
Accepted by Sonti_11532

## Re: Search two different elements from excel

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

Message 3 of 13
(2,127 Views)

## Re: Search two different elements from excel

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

Message 4 of 13
(2,096 Views)

## Re: Search two different elements from excel

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

Message 5 of 13
(2,083 Views)
Solution
Accepted by Sonti_11532

## Re: Search two different elements from excel

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,
India AE
National Instruments, India

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

## Re: Search two different elements from excel

@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

--------------------------------------------------
The best way to say thanks is to give kudos!
Message 7 of 13
(2,008 Views)
Solution
Accepted by Sonti_11532

## Re: Search two different elements from excel

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

Ben64

--------------------------------------------------
The best way to say thanks is to give kudos!
Message 8 of 13
(1,992 Views)

## Re: Search two different elements from excel

Thank you very much for the replay.

Message 9 of 13
(1,969 Views)

## Re: Search two different elements from excel

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

Message 10 of 13
(1,054 Views)