取消
显示结果 
搜索替代 
您的意思是: 

Search 1D array doesn't works.

已解决!
转到解答

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 项奖励
1 条消息(共 14 条)
5,340 次查看

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 项奖励
2 条消息(共 14 条)
5,334 次查看

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 项奖励
3 条消息(共 14 条)
5,329 次查看

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 项奖励
4 条消息(共 14 条)
5,325 次查看

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 项奖励
5 条消息(共 14 条)
5,324 次查看

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 项奖励
6 条消息(共 14 条)
5,294 次查看

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 项奖励
7 条消息(共 14 条)
5,256 次查看

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 项奖励
8 条消息(共 14 条)
5,251 次查看

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 项奖励
9 条消息(共 14 条)
5,242 次查看

Hi Dennis,

 

Thanks for your help.

 

I will try it now.

 

Firdaus

0 项奖励
10 条消息(共 14 条)
5,228 次查看