Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

srt

Member

10-13-2005 08:54 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi, all

If I want to compare a requirement number and extract a number form a continuous data, . for example,

the string like this ( ******** 123 ******

*********456 ******

*********789*******)

and I have requiremnts that I need to extract the number is nearest greater 450, so in the above example, I need to pick 456.

How can I result it?

thanks

PJS

Active Participant

10-13-2005 09:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

here is one way to do it.

10-13-2005 10:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Thanks Pana

I nearly understand the method to solve the problem. But I am quite new in labview and I don't know some of the function you draw in jpg. Can you upload the Vi and have a look.

Thanks again.

altenbach

Knight of NI

10-13-2005 10:52 AM - edited 10-13-2005 10:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Just extract all numbers into an array, then find the element with the smallest absolute difference. See attached (LabVIEW 7.0).

EDIT: Sorry, If by "Nearest greater" you mean the next higher number, you can use something like in my example II. (Also LabVIEW 7.0).

If you don't recognize an node, just right-click on it and select help. 🙂

You still need to add proper execption handling, e.g.:

- What if no element is greater?
- What if there are multiple solutions?
- What if the string does not contain any numbers?

Message Edited by altenbach on 10-13-2005 09:05 AM

Download All

Virus scan in progress. Please wait to download attachments.

altenbach

Knight of NI

10-13-2005 11:41 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

10-13-2005 02:33 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Thanks a lot and I can find the answer .

and I have another questions, still like this

I have a string for example( *****123**** (some number-such as 0.01%)****

*****456**** (some number-such as 0.02%)****

*****789**** (some number-such as 0.03%)****

I still need to extract 456, but i also need to extract the 0.02%, (the number follow the 456), I have a idea, but maybe too complicated.

I just though when i got the 456, and match it with the original string and then extract the following number. but i am not quite sure how to do it?

PJS

Active Participant

10-13-2005 02:41 PM - edited 10-13-2005 02:41 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Before people jump into solving this problem, do you have any other surprises hidden in this string that will need to be evaluated? Is the number with the % ALWAYS there or sometimes? These things definitely affect the approach to the problem! Are there a fixed number of * between the two numbers? Can you post an example of a complete dataset that would be in this string?

Message Edited by Pana-man on 10-13-2005 03:42 PM

altenbach

Knight of NI

10-13-2005 04:05 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I agree with Paul, we need more info on the string structure:

- Is each pair on a seperate line?

10-14-2005 03:01 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Thanks

Please see the attach JPG file. IF I want to extract the number in the first red square and pick the second red square number which includs the %.

how to do it?

thanks

AdamB

Active Participant

10-14-2005 04:28 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

srt,

Looking at what you have posted it is still a little unclear as to what you actually need.

Are you extracting that number for any reason? (say nearest to a certain number?)

If you send in an actual text file with that dataset on I will try and create an example code for you to try out but I also need to know what number you need to extract and why.

Many Thanx

AdamB

National Instruments UK

Applications Engineering Team Leader | National Instruments | UK & Ireland