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 format a string?

I am trying to format a string using (Concatenate Strings). It works but the last item in the string is shown on the next line.


What I'd like to have is the following :

Time stamp        Label       Value      Result

What I am getting is the following :

Time stamp        Label       Value    
 Result


Your help is appreciated.

Regards
Aieman


0 Kudos
Message 1 of 9
(2,997 Views)
What makes you think it is producing the result you show? When I run your vi, the file produced is all on one line. Similarly, placing a string indicator on the panel and setting it for \ codes display does not indicate any problem.

Lynn
0 Kudos
Message 2 of 9
(2,984 Views)
When I run your vi I get

" 14:09:53.51        Lable                 fail"

Array to spreadsheet string appends an EOL constant at the end of the string, which is why you'd see "Result" on the next line.  To remove it, see the attached modified vi.
0 Kudos
Message 3 of 9
(2,983 Views)

Thanks  johnsold and  Novatron

I have Labview 7 so I couldn't open Novatron's file

I have attached the text file of the results to see what I am getting.

 

0 Kudos
Message 4 of 9
(2,976 Views)

string concatenation is nice but I find the string format function more practical for complex concise coding of sting formating issues.  You use this in a very similar manor to printf statements in c is "%s\t%s\t%s\t%s" for a tab delimited string.  Any thoughts here?

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 5 of 9
(2,967 Views)
Oops, sorry about that.  I'm having a bit of trouble saving as a previous version (new to LV 8 - yesterday), but all I did was put a "Trim Whitespace" on the output of the Array to Spreadsheet String.

That *should* solve your problem.  If not, come back and let us know.
Message 6 of 9
(2,966 Views)
Thanks falkpl

I have tried that but it didn't work.
Please see attachment.

Regards

Aieman
Download All
0 Kudos
Message 7 of 9
(2,956 Views)
Here is a version with the Remove White Space and the Format into String options. I disabled the write to file and just put two indicators (set to '\' Display) on the panel to see what was happening.

Lynn
Message 8 of 9
(2,941 Views)
Many Thanks Guys for your time and effort.

Lynn I have modified your file a littel bit and it did work.


Regards

Aieman

Download All
0 Kudos
Message 9 of 9
(2,929 Views)