Hi,

I am trying to to implement this algorithm with the vee.

and I get stuck while trying to build the algorithm.

can some one help me?

Hi,

I am trying to to implement this algorithm with the vee.

and I get stuck while trying to build the algorithm.

can some one help me?

VEE has a built-in sort() function. Sometimes you need to provide a key ( separate column of values ) to make the sort occur in the right way but it's slick!

I didn't answer your question. I suggested sort(), which of course sorts an array by order ( which may be value or it could be dictionary if text ). I do have a technique for ( quickly ) finding if a given text is within an array but you're looking for the nearest number in an ordered array ( I assume ) to the one you provide..

So you're right, you could implement a binary search ( which would be interesting ). The pattern I use is a more graphical method ( see attached ). In this I have ( effectively ) put in a horizontal line at the given value and then used a function to pick out the index value where that crosses. You can swap it around to look at the array reversed, look for minIndex with a clipLower and so forth. It might look a little strange but it's fairly compact ( number of VEE objects ) and fast.

If you do decide to implement a classic binary search it would be worth posting that here for others; you could try a comparison in speed too.

Hey Mike,

First of all I want to say thank you for your help.

Second, you wrote 'see attached' did you send a file? Because I can't see

it.

I will try what you suggested.

בתאריך 24 במרץ 2017 14:18, "Mike" <moderator_forums@keysight.com> כתב:

Keysight Community <https://community.keysight.com/?et=watches.email.thread>

Re: binary search

reply from Mike

<https://community.keysight.com/people/Mike?et=watches.email.thread> in *VEE

Software* - View the full discussion

<https://community.keysight.com/message/77547?commentID=77547&et=watches.email.thread#comment-77547>

You can try to format your data in an array/vector. Then make the search using a Matlab box calling the "find" function, which actually makes the search. This way you have your search problem solved and you do not need to implement specifically the algorithm you wish.

A different idea is whether you want to know how to encode your algorithm in VEE.

can some one help me please??