10-23-2008 11:48 AM
Hi
I am trying to format a signal that is oming out of a Sample Compression VI and write it to a file. what VI should i use to format the data?? I am trying to add more decimal points to a certain value.
I cant use "format into file" VI, can I? because that VI formats string inputs,right?
10-23-2008 01:29 PM - edited 10-23-2008 01:29 PM
When you say you want to "add more decimal points" this seems to imply that you're already writing to file. What are you using to do so?
The Format Into File function is not limited to string inputs. The format string defines how the inputs are interpreted. Since you have dynamic data you will not be able to use that function directly. You would first need to convert it to an array of numbers, and then place the function in a loop. However, at that point you'd be better off using the Write to Spreadsheet File function. You can wire the dynamic data to its 1D/2D input (depending on the data that you have), and a Convert From Dynamic Data function will automatically be inserted for you. Another option is to use Write to Measurement File.
10-23-2008 01:37 PM
Yes I am writing it to a file using Write To Measurement VI.
But I guess defualt value of Labview to write numbers is to 6 decimal points, I want to get more precision.
Data that is coming from Sample compression has 10 columns of numbers and i just want to increase the precision on the numbers.
10-23-2008 02:00 PM
Unfortunately, the Express VIs don't provide much flexibility. You can convert the Express VI to a regular VI by right-clicking and selecting "Open Front Panel". You would need to dig through the code (which is a bit convoluted) to find where the conversion to string is being done.
One suggestion that I had read somewhere was to use a copy of the Export Waveforms to Spreadsheet File function. If you look at the code for this function it's easy to spot where the conversion to string is done: it's right in the loop at the lower left, and it uses 6 decimal places. Note that you should make a copy of this function. Do not modify the function, as this is a core LabVIEW function.
I think, though, that the Write to Spreadsheet File will give you the most flexibility as you would not need to modify any VI, and you can specify the format as an input to the function.
10-23-2008 02:18 PM
When you say code, do you mean when I open the front panel of VI? because when i open that there is no code!!! All there is just the tabs and other stuff that are in Vi properties.
and how can is specify the format as an input to the function for Write to Spreadsheet File ??
10-23-2008 02:41 PM
10-23-2008 02:42 PM
10-23-2008 02:49 PM
10-23-2008 03:07 PM - edited 10-23-2008 03:07 PM
All right, one question at a time... ![]()
Any Express VI can be converted to a "regular" VI by right-clicking on its icon on the block diagram and selecting "Open Front Panel":
This will allow you to resave it under your own name.
The Write to Spreadsheet File has an input called format. This is a string in which you specify how to format the numbers. The default value is %.3f, which means 3 decimal places. If you want 10 decimal places you would wire a string with a value of %.10f (note the decimal point in there). If you wire the output of Sample Compression to the 2D data input of Write to Spreadsheet File, LabVIEW will automatically insert a Convert From Dynamic Data function so you get the 2D array of numbers that's contained within the dynamic data. Try it. The downside of using this method is that you lose all the extra formatting that you get with Write to Measurement File. Of course, you can manually put all that in, but it may not matter for you.
10-23-2008 04:53 PM
sorry about that 😛
can you show me a way to directly change the format for Write to Measurment VI?