09-09-2018 03:03 PM - edited 09-09-2018 03:05 PM
Hi, I have a serial string parsing vi that I made that uses the sub-vi Write to Spreadsheet File (DBL). When I open the file generated by this vi, I see that all my data is rounded to 3 decimal places. I would like it to be 8 decimal places. In the sub-vi, I see that the format field is %.3f and so I change it to %.8f and save it. Then I save the higher level vi.
However, when I run the higher level vi again, and look at the generated file, the numbers are still only out to 3 decimal places. And when I check the Write to Spreadsheet sub-vi, the format field has reverted to %.3f, like it never actually saved. What is happening here? I checked that the sub-vi file is not read-only, so it should be saveable.
Take a look at the two images attached. The first is the basic structure of the telemetry going into the Write to Spreadsheet sub-vi. As an example, the "8u Detector Voltage" telemetry that is formatted as DBL is one piece of telemetry experiencing the round-to-3 decimal places issue. The second image is the Write to Spreadsheet File vi, and you can see the format field that I am trying to change from %.3f to %.8f with no luck.
09-09-2018 04:56 PM
That Write to Spreadsheet file is built into LabVIEW. You shouldn't change it and save it, if that is what it sounds like you are doing.
What you need to do is create a control or constant in the main VI for the format string and wire that into the subVI. That is what I don't see in your LV1.jpg picture. So it will use the value that is in the subVI %.3f.
(I'm guessing if that if you edited the subVI, you changed the value in the control, but forgot to save the new value as default.)
But DON'T CHANGE LabVIEW BUILT-IN VI"s.
09-09-2018 06:01 PM - edited 09-09-2018 06:15 PM
All you need to do is wire a string constant with "%.8f" to the format terminal, nothing else.
Right-click the format terminal in your VI (the caller) and "create constant". Enter the desired format! (I would not use a "control", because you would need to change the default value unless it gets wired from higher up)
Do NOT modify system VIs! Never! Ever! It will mess up all other programs that rely on the default format value. Most likely, if you just changed the format value and saved, nothing was modified. For the new format value to "Stick", you need to make the new value the default, but I won't even tell you how to do that because you should NOT modify VIs that ship with LabVIEW! (did we all just say that? I cannot repeat it more often!).
09-10-2018 10:39 AM
Thanks all, wiring in the format externally worked like a charm. And point taken on not messing with Labview's internal VIs.