02-18-2009 09:34 PM
Hi,
I have been trying to solve the following problem for weeks. I'm to save the measurement from an instrument which I parse and read using the I/O assistant as no driver is available for the instrument I am using.
I have no problem extract the measurement value from the instrument into string format, however I have problem trying to save it into an tab delimiter file. Following is the attachment of an image of my program, expected output file and problem output file.
I was wondering is it due to the processor reading time as when I run the program the value been extract from the instrument doesn't arrive at the string indicator at the same time or my programming is totally wrong. Any help pls thanks
Law
02-18-2009 09:47 PM
It is hard to debug from only a small screenshot of your code.![]()
You have two I/O assistants. Are they talking to the same instrument? One seems to be laying over top of the wires of the other one, but I don't see any relationship of when one executes relative to the other. Either one could execute first, and as a result the reading and writing to the same instrument, the two assistant's could step all over each other. One could wind up reading the response intended for the other. Try wiring up the error clusters to enforce the order of execution. And don't have wires running behind other objects.
What is exactly wrong and different between your two text files? It seems like in one case you have a line feed after the first data point, and in the other, an extra line feed after the second.
Inspect the data coming in from each assistant. It looks like you are getting an extra line feed (or carriage return) put in there from one of the responses which you may have to strip out, or adjust the I/O assistant so that in knows how to ignore it.
02-19-2009 02:50 AM
Yes the two I/O assistants is talking to the same instrument.
As for the text files, the one name problem was what I get from the
programming as for the one name excepted is the one I want to create.
at the concatenate strings I write the 1st string to be time follow by a
tab constant then second value follow by tab constant ..... Thus I should 25 header all tab delimited. However when i try it with only three input and i get the following which i doesn't understand why?
11:14:48 "-78.4"
"-78.1"
I wanted the file to be a tab-delimited file
11:14:48 "-78.4" "-78.1"
I will be doing the rewiring of the program but however I would like to solve the file saving problem as soon as possible. Any more help will be grateful thanks'
02-19-2009 02:54 AM
Well, looking at the problem.txt file the only problem is the existence of a line feed caracter just after the first number - lvl cur - my guess is that if you display that value (i.e. string) in codes-display (right-click on the lvl cur indicator and select codes display) you will see the unwanted line feed just behind the number...
You can fix it either by changing the code that extracts the value so that it does not include/add the line feed, or simply cut off the line feed by taking a subset of the string or simply use the "Trim Whitespace.vi".
If the line feed comes from elsewhere - hunt it down by adding one and one element to the concatinate function and see when the additional line feed occurs....when it does, there is you line feed source.
02-19-2009 03:55 AM - edited 02-19-2009 03:56 AM
Hi
You have fallen in the Express VI trap
As I have said before most of the Express VIs are just useless flimflams. Well anyway since your deadline is near I suggest you use this solution. It is not a cure but it removes the symptoms

02-19-2009 04:20 AM
Hey Mads,
Thanks so much I have finally solve the problem. Can I ask you how can I add header to my file?
Thanks again
Law
02-19-2009 09:09 AM
Lawn wrote:Hey Mads,
Thanks so much I have finally solve the problem. Can I ask you how can I add header to my file?
Thanks again
Law
Hmmm. I thought I said in my message that you had an extra line feed?![]()
Yes you can add a header. Write a string to the file, but do it one time before you get into the looping part of your program.