From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to print obtained string in read buffer into a table in front end ?

Solved!
Go to solution

Hi. I want to print the string obtained in read buffer into a table in front end. I am performing serial communication with a machine, where i am supposed to pass a command to get response. The machine which i am trying to communicate has 6 cylinders , when i pass command "b" it sends the values of the cylinders in the form of string. Example : when "b" is passed i get " b 50.8 54.8 60.2 65.3 57.0 61.6 " in read buffer . I want to put these values in a table in front end.Can you please give a hint/ solution to my problem?.I have attatched the vi. Thank you.

0 Kudos
Message 1 of 7
(3,962 Views)
Solution
Accepted by topic author madara77

Hi Madara77,

 

Table is an array of stings, first think how you can get the array from the above string,

 

Here you need to parse the string properly, for the string " b 50.8 54.8 60.2 65.3 57.0 61.6 "

 

1. Remove first and last space, Remove , (Use string subset function)

 

2.Now you have "50.8 54.8 60.2 65.3 57.0 61.6"

 

3.Now try to get the array from above string Use Spreadsheet String To Array function

    a) use delimeter as space constant.

    b) Array type as string 2D array

 

Now, just wire this array to table indicator.

 

hope it helps.

-
Amit
CLAD
Message 2 of 7
(3,943 Views)

I could get values in the table,but when I get next set of values the previous values are getting replaced in the table .How to update(to the next row) the values in the table as the next set of data arrives.

0 Kudos
Message 3 of 7
(3,872 Views)

@madara77 wrote:

I could get values in the table,but when I get next set of values the previous values are getting replaced in the table .How to update(to the next row) the values in the table as the next set of data arrives.


You should store the table values in a shift register and then use Build Array to add new rows to your table.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(3,859 Views)

Hi. I could get values in the table. The set of values sent by the machine is getting stored in each row. Suppose if i want to flush all data after some 10 set of values and again store next set of values from beginning of the table what should i do?

0 Kudos
Message 5 of 7
(3,838 Views)

@madara77 wrote:

Suppose if i want to flush all data after some 10 set of values and again store next set of values from beginning of the table what should i do?


Assuming you are storing the table in a shift register, you just write an empty array into the shift register and it will be cleared.  If you want it to happen every X iterations, either use the i and a Quotient & Remainder or keep you own counter so that you know when to clear the table.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(3,812 Views)
i am getting string data through visa. the data starts either with t or b. i want to put the data into two tables depending on whether the first character is t or b. i am confused about this. please help me.
0 Kudos
Message 7 of 7
(3,774 Views)