Jump to content

Scan from String


miab2234

Recommended Posts

Hallo Guys,

I made an experiment and i cant come further with my programm. i want to know with my programm,how many points it measured and then i want to make the Graph (X,Y) of that points:

Check out my programm.I have given the measuredpoints in block diagramm.

I thought that everypoint is seperated with semicoloum.The other thing is how can i change the measuredpoints in realnumbers so i can make a (X,Y)graph of that measurednumbers

I my programm it has to show the number of measured points 10 and the Graph.

Check out my programm

Waiting for reply

Miab

Link to comment

I've attached a modified verson of your VI. It's a little simpler than you had. Look on the block diagram for a few notes.

Best of luck,

Dave

QUOTE (miab2234 @ Dec 4 2008, 10:38 PM)

Hallo Guys,

I made an experiment and i cant come further with my programm. i want to know with my programm,how many points it measured and then i want to make the Graph (X,Y) of that points:

Check out my programm.I have given the measuredpoints in block diagramm.

I thought that everypoint is seperated with semicoloum.The other thing is how can i change the measuredpoints in realnumbers so i can make a (X,Y)graph of that measurednumbers

I my programm it has to show the number of measured points 10 and the Graph.

Check out my programm

Waiting for reply

Miab

Link to comment

QUOTE (David Boyd @ Dec 5 2008, 05:50 AM)

I got how to make the number of measured points but the thing,if i dont use semicolum and the end of my every measured point but the labview has to defrencitate everypoint of its own.for that i have to use the match pattern right ?

Now see my measured points.I tooked out the semicolum now .I doest want to make everytime semicolum at the end of every measured point. I need that labview automatically take every X,Y.

How can i deferenciate everypoint ?

waiting for reply

QUOTE (miab2234 @ Dec 7 2008, 05:09 PM)

I got how to make the number of measured points but the thing,if i dont use semicolum and the end of my every measured point but the labview has to defrencitate everypoint of its own.for that i have to use the match pattern right ?

Now see my measured points.I tooked out the semicolum now .I doest want to make everytime semicolum at the end of every measured point. I need that labview automatically take every X,Y.

How can i deferenciate everypoint ?

waiting for reply

I got it :).Hope its right what i did.If there is something wrong please tell me

Best regards,

Miab

Link to comment

QUOTE (miab2234 @ Dec 7 2008, 12:06 PM)

I got how to make the number of measured points but the thing,if i dont use semicolum and the end of my every measured point but the labview has to defrencitate everypoint of its own.for that i have to use the match pattern right ?

Now see my measured points.I tooked out the semicolum now .I doest want to make everytime semicolum at the end of every measured point. I need that labview automatically take every X,Y.

How can i deferenciate everypoint ?

waiting for reply

I got it :).Hope its right what i did.If there is something wrong please tell me

Best regards,

Miab

Well, the Match Pattern you added back in is still not doing anything for you, and is still not needed in the example.

See how the string enters the left border of the While Loop? As a solid little rectangle? That is a simple tunnel. This means that the entire input string is on the wire on the inside, unchanging through all the loop iterations. Your Match Pattern looks for a semicolon character, and since there isn't one (in your revised sample data), passes the entire string out of its 'Before Match' terminal. Every iteration, unchanged.

The Scan From String node has a format string input which says it should find two floating point numbers - that's the %f specifiers. The leading format specifier, the one that is a %,; is a special token that says that the decimal radix character is a comma. My LabVIEW needs this since in my locale (USA), the radix is a decimal point, and your input strings 'look' European. You may not need this specifier. (This would be a good time to update your LAVA profile to proudly declare your nationality. It can be helpful to others, as in this example. Plus, it's always interesting to see.)

So, the Scan From String finds two floating point numbers separated by any amount of non-numeric characters - maybe a semicolon, maybe just whitespace, works either way. Now, here's the magic part: the Scan From String also returns an integer which says how far into the input string it had to look. We pass that around through a shift register for the next iteration. This tells the Scan From String to start looking for the next two numbers that far into the original string, skipping over the ones it has already converted. It's much more efficient to do it this way than to keep breaking up the original string, which moves the (potentially huge) string around in memory.

You got the array size, though not in the way I would have recommended. The iteration terminal starts with zero, so the last iteration number is one less than the count of iterations - it's important to understand the distinction. You 'got lucky' because the last iteration in this example, by definition, is a failure - we exit the loop after we fail to parse any more numbers. That's what the Delete From Array node does at the end - it throws away the last, invalid array element. I would have recommended you use the Array Size? node on the final output. Neat, tidy, and clear (to a LabVIEW programmer) what the intent is.

I still think you have your notion of X and Y reversed when your dataset is plotted. The data suggests a function to me, which implies only one Y value per X. Your plot would not describe a function.

Finally, and no offense intended, please don't PM me about examples. Use the forums for this. It allows others to follow the dialog, so you'll have more chances to get good help, in case I'm too busy to respond.

Best of luck with your LabVIEW learning! (It can be both fun and profitable!)

Dave

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.