From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search 1D array doesn't works.

Solved!
Go to solution

Hi.

 

I have a bunch of data. Let say 48000 elements. And from it, I try to search, one element using 'Search 1D array' .

 

However it doesn't work as wanted.

 

I put an indicator on output of the 'Search 1D array' , but the value always "-1".

 

Anybody could help me. Please refer to my VI as reference. The 'Search 1D array' is used under case structure of "Synchronize Pressure and Alpha".

 

Thanks.

 

Firdaus

 

0 Kudos
Message 1 of 14
(3,558 Views)

hi,

i can not open ur vi as i have labview8.5. It should find the element from array if ur array has that element. try this..devide or split array into two and then search...or instead of using search 1D array u can use for loop and search array element separately.

 

 

GAK

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 2 of 14
(3,552 Views)

Firdaus,

 

the origin of your array is a DAQ channel and the numeric type is DBL. Never ever compare DBL to "equal", but that is what "Search 1D Array" does. So either convert your data to integer first or write another search-algorithm which is capable to search for ranges....

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 14
(3,547 Views)

hi norbert,

 

can you tell me why you should "Never ever compare DBL to "equal",  ? I am new to LabView.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 4 of 14
(3,543 Views)

You do a search on a floating point number, presumably the value is no 0 but something slightly different than zero. This is normal for any computation system, I suggest you to use an In Range function with -0.00001 and 0.00001 as limits and than search for the first value that is actual In Range.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 14
(3,542 Views)

Hi Norbert, Gak and TonP,

 

Thank you for answering my question.

 

Gak,

I dont know how to convert to version of 8.5.

 

Norbert,

I already change to integer, but it still doesnt works.  

 

TonP,

I would like to know a bit idea on how to use this function.

You suggest me to use 'In Range and Coerce' function right?

 

If that so, i should set the upper limit as 0.00001, lower limit as -0.00001 and the 'x' should be the value needed.

 

While the output 'Coerced (x)' is then connected to the 'Search 1D array'? Is this what you mean?

 

Thanks.

 

Firdaus

 

 

0 Kudos
Message 6 of 14
(3,512 Views)

Firdaus,

 

could you please post your updated code?

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 14
(3,474 Views)

Hi Norbert,

 

Please find the attachment below.

 

By the way, could you give one example on how to change the array from DAQ into integeter. Because, as from your suggestion, I simply use converter 'To Unsigned Byte Integer'.

 

Firdaus

0 Kudos
Message 8 of 14
(3,469 Views)

No. You are not using the In Range and the Search 1D Array correctly at all. You need to replace the Search 1D Array with the In Range function inside a loop and you do not use the Coerce output at all.

 

Using your example, you would add the +/- 1e-5 to the .0253858. These values are the upper and lower limits. A quick example is shown below.

 

Message Edited by Dennis Knutson on 05-12-2009 09:00 AM
0 Kudos
Message 9 of 14
(3,460 Views)

Hi Dennis,

 

Thanks for your help.

 

I will try it now.

 

Firdaus

0 Kudos
Message 10 of 14
(3,446 Views)