06-12-2009 03:01 PM
Hello all : )
I have made a program and am trying to use the write to file function. I am opening it with microsoft word and notepad, and the values for each are just 0.000 for however many values I have collected. Any suggestions?
06-12-2009 03:48 PM - edited 06-12-2009 03:54 PM
How small are the numbers you are trying to write? Are they less than 0.0005? Do you have any values in your array called "Charge"?
By the way, why in a few places do you split wires, but not use the split. In the For loop near the stop termianl of the while loop, you split the wire and send it to two auto indexing tunnels, one you use, the other you don't. In the For loop containing the formula node, you have an autoindexing input which you send to the formula node, but before that you send a branch to the for loop and it is an auto indexing output tunnel. But you don't use it. Even if you did, it would be the same array as the array going into the For loop. I don't know how many elements you have in your arrays, but it makes unnecessary data copies.
06-15-2009 08:49 AM
oops..I had some cleaning up to do. sorry about the confusion, I think that I removed all of the excess wires.
And yes, my values are smaller than that. They are around the 10 e-12 range. Is there something special I have to do for small values?
Thanks again for your help!
06-15-2009 09:00 AM - edited 06-15-2009 09:00 AM
sbev001 wrote:And yes, my values are smaller than that. They are around the 10 e-12 range. Is there something special I have to do for small values?
Your format string is %.3f. This means 3 decimal places. For a number in the 10E-12 range this is simply 0.000, so the number you get in the file is absolutely correct, based on what you told it to write out. Change your format string to %f or %g. Look at the LabVIEW Help for that function - it contains a link to the format string specifier syntax.
06-15-2009 09:03 AM
06-15-2009 10:31 AM
Thanks, that worked! I was just going through and testing and realized that I wasn't getting the results that I wanted. I want for each charge to add on to the previous value in the array, so that the end result is a the total integrated charge. How would I set this up?
Thanks again for your help : )
06-15-2009 10:50 AM - edited 06-15-2009 10:51 AM
Store your total charge in a shift register. Each loop iteration, add the new value to the value in the shift register and put it back in the shift register. Remember to initialize the shift register with zero.