LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from String

Solved!
Go to solution

Hello all,

 

The question that I have is probably really trivial, but I apparently I am stuck with it. The task I am trying to perform is to transfer a "string of data" that I am getting from reading through RS232 port of a motion controller(relative coordinates of the motor position), into an array, so I can use it further to plot path curve. The string looks as follows:

 

TPM:*TPM+1274.36,+56.149,+0,+0

 

and I want to move two of those four numbers into data file, something like this +1274.36,+56.149, per row

 

when I put "write LVM" express VI and wired "read from rs232" to "signal in VI" it gives me error that data does not match. So I have a feeling that the string needs to be modified in some way before it can be written into data file.

 

Can anybody help me with this issue please?

 

Thanks in advance

 

This is my VI:

 

0 Kudos
Message 1 of 4
(2,863 Views)
Solution
Accepted by topic author Oleks

You will need to use a function such as Match Pattern on the string palette.  The pattern to search for would the the TPM:*TPM part assuming that is common on every line of data coming in.  Then write the part after the match string to a text file.

 

Since you just want to write the data to a text file, don't use the Express Measurement File function.  That really only works well if you already have a "Signal" data type like the ones coming from other Express VI's.  Just use the Open, Write, Close text file functions on the File I/O palette instead.  Search the Example Finder for some examples.

EDIT:
I'm sorry, I missed the part about not writing the last two points.  Since what you just posted works for you, go with it.
Message Edited by Ravens Fan on 01-16-2009 09:13 PM
Message 2 of 4
(2,851 Views)
Apparently I was able to get what I want, would it be the "correct way" to handly such kind of task? 
0 Kudos
Message 3 of 4
(2,850 Views)

Thanks Ravens, I was typing repy to myself before I saw your reply 😉 I am going to correct the output into more appropriate one, as you suggested 😉

 

 

0 Kudos
Message 4 of 4
(2,845 Views)