05-11-2012 02:40 PM
%s\t%f\r%f
This is a format string that I have in old code that I've decided to change. Problem is I cannot make sense of the string codes in my own old code! Let me explain what I want, and hopefully someone can explain how to do it.
I am using the format into string subvi to merge a time stamp (formatted as %m%d%Y%H%M%S%5u) and two different double precision numbers. This string is then wired into the Write Characters to File subvi so that I can record data as a .txt file, and open it in either Matlab or Excel. There is a minor problem with the string format above because in excel the first time stamp entry is blank, and the first loop only gives the two double precision numbers withouth the time stamp - the time stamp appears in the next loop (probably a looping issue and not due to the string format, but if you see differently please let me know). Now what I want to do is 1. potentially fix that problem and 2. add some more doubles.
1. Is there a string format issue that is evident that I am not seeing that causes the time stamp to be formatted into the string after a carriage return? Or should I be looking at looping issues?
2. How do I add another one - three floating point numbers (double precision)? Are the \'s marking different numbers in this string constant? Or is it the %? I can't find any information about the \'s, but I see that % begins the format specifier.
Ideally, I want these data in the following columns: Date, Time(absolute), FP, FP, FP, carriage return for the next loop (FP is floating point double precision number).
Thanks,
Brad
05-11-2012 03:03 PM
\t is the code for the tab character
\r is the code for the carriage return
Look in the LabVIEW help for format codes and also backslash codes.
05-11-2012 03:21 PM
You could use something like this to build up your floating point values
:
05-12-2012 09:12 AM - edited 05-12-2012 09:12 AM
Hi JonN,
Here there is no need of string concordinate function (in your code), the same result you can find if you connect the output of the format string to shift register, and shift register in data to initialize string connector in format into string function.
<<KUDOS ARE WELCOME>>