LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting a signal

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?

0 Kudos
Message 1 of 11
(3,952 Views)

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.

Message Edited by smercurio_fc on 10-23-2008 01:29 PM
0 Kudos
Message 2 of 11
(3,937 Views)

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.

0 Kudos
Message 3 of 11
(3,933 Views)

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. 

0 Kudos
Message 4 of 11
(3,923 Views)

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 ??

 

0 Kudos
Message 5 of 11
(3,915 Views)
I got what you were saying about  Export waveforms to spreadshit.
0 Kudos
Message 6 of 11
(3,908 Views)
but i can't find it for Write to measurment file!!!!
0 Kudos
Message 7 of 11
(3,907 Views)
how can is specify the format as an input to the function for  Write to Spreadsheet File ??
0 Kudos
Message 8 of 11
(3,905 Views)

All right, one question at a time... Smiley Very Happy

 

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.

Message Edited by smercurio_fc on 10-23-2008 03:07 PM
0 Kudos
Message 9 of 11
(3,899 Views)

sorry about that 😛

can you show me a way to directly change the format for Write to Measurment VI?

0 Kudos
Message 10 of 11
(3,877 Views)