09-18-2017 06:09 PM
Hello,
The attached VI deals with reading and writing a plc and load cell conditioner. The loadcell output (server1) writes to file very well except is tab separated and I would prefer coma. I would really appreciate some advice how to incorporate the other reads and get them all on one line, comma separated with time stamp. There will be a while loop, of course, around the whole scheme to keep it running. One problem I frequently come across is that the data types are wrong for whatever VI I try to add.
Solved! Go to Solution.
09-19-2017 01:29 AM - edited 09-19-2017 01:30 AM
Hi Ed,
except is tab separated and I would prefer coma.
Right now I don't see any place in your VI where you even define a separator char.
When you want to use a comma you should define a format string for your FormatIntoFile function…
some advice how to incorporate the other reads and get them all on one line, comma separated with time stamp.
First write the timestamp to your file, then write "the other reads", then write your holding register to the file.
Use a format string which fits to your requirements!
One problem I frequently come across is that the data types are wrong for whatever VI I try to add.
Then you need to convert them to the needed datatypes…
Btw. it's a very bad habit to hide control/indicator labels in the block diagram!
09-21-2017 07:43 AM
HI GerdW
I see your point, I imagine that I could either try to write each value to an array and then write the whole lot to a file or try to append each value to the file consecutively, I dont know which is best. The nice thing about Labview is that you can try things out and if it doesnt work out , no harm done, to have the opinion of an expert though might save a day or so.
Ed
09-27-2017 04:21 PM
I have tried the option of putting all data reads in arrays then writing all to file but it doesnt look good and for some reason the link between the concatenate strings and write to spreadsheet file functions doesnt work. I know that the source is string and sink is 1D array of strings but I have seen a youtube where this worked. Any solutions?
09-27-2017 05:10 PM
If you want to build an array it might be a good idea to use the Build Array Function not the Conncatenate Strings functions.
BTW, the flat sequence can be omitted - Dataflow already does the job.
The For Loop also is useless as you request the same values 3 times, but only use the last value.
Regards, Jens
10-01-2017 03:39 PM
Hi jg69,
If anyone else is searching, I have found a solution to write multiple reads on one line. I found that the build aray function will concatenate, which can be altered in the shortcut menu by selecting "concatenate inputs". I also used part of a 2D Boolean to string.vi which I found on a post by P@Anand, to write booleans to an array with a for loop. So I changed the tunnel in my for loop to do the same with the three consecutive reads - which you pointed out would only give a final value. Some of the inputs had to be treated differently to get them all on one line.
Thanks for your suggestions,
Ed