12-27-2005 06:57 AM
12-27-2005 07:48 AM
12-27-2005 08:12 AM
@aravind_phd wrote:
Hi all,I have been acquiring 4 channels ( two colums for each channel) of data and have been storing them in a txt file. I'm trying to plot the waterfall plot of a specific channel data and i need to read 1024 values of the data from a specific column of the txt file. I have tried the read file example, but i'm not able to control the samples read at a time. i don't want to read the whole file, cause the size is around 80MB.I'm using Labview 7.Any suggestions or help is very much appreciated.Aravind
You have to keep in mind how data is stored in a file like this. It is as if it were a one long 1D byte array. It may look formatted into columns of data when you print the file but it's just one long string of bytes to LabVIEW. To get to any one particular byte or set of bytes you need to wade through all the bytes that precede it or them. Assuming the routine that wrote the file wrote an ordered pair of values for Ch #1, a pair for Ch #2, a pair for Ch #3, a pair for Ch #4 and then repeated, you can then use that pattern to figure out where the paired data for any reading of any given channel is stored in the file. You can then read out one pair or 1024 pairs as needed using the "read offset" parameter you can specify to the file read function. Note that while you are reading the file you will need to keep track of how the ASCII data is stored, formatted and delimited and adjust the byte count and offset accordingly to account for the extra characters. If your file data is formatted appropriately try the Read From Spreadsheet File function.
It would probably be more efficient if you were to figure out where the 1024 pairs you are interested in started for channel #1 and then read out all the pairs for channels 1-thru-4 in one read operation (8192 values). Depending on how the data is formatted in the file, the spreadsheet string to array function may help in converting the incoming byte string into ordered numeric values. Otherwise you would process the 1D byte stream data array read in to get just the data for the channel of interest. That would involve recognition of the various value delimiters (spaces and/or commas and/or end-of-line markers) and the values separated by them and decoding of the ASCII values into numeric values.
It all starts with knowing exactly how the data is formatted throughout the file...
12-27-2005 11:38 AM
I'm sorry for not mentioning the file type.. and other details..
I have used the default write file which comes with the LabVIEW 7 (Write LabVIEW Measurement File ). I have writing the data in ASCII format with tab as the Delimeter...I have copied few lines of my data file.
*****************************************************************************
0.000000 -1.820420 0.000000 -0.000915 0.000000 -0.523118
0.000250 -1.458149 1.000000 -0.004333 0.000250 -0.754687
0.000500 -1.300527 2.000000 -0.010562 0.000500 -0.870796
0.000750 -1.187986 3.000000 -0.019016 0.000750 -0.938580
*****************************************************************************
There are 3 channel data, the first column is the time stamp and the second column is the actual data of the first channel..
Thanks again..
Aravind
12-27-2005 02:40 PM - edited 12-27-2005 02:40 PM
If there is no change in sign (positive or negative) then it is not very difficult to calculate the offset to reach a given record.
Each line is composed of 57 chars (including the tab and return separators and the 3 negative signs).
The simplest solution is to use the Read from Spreadsheet File vi. To read the nth chunk of data, you need to read 1024 rows from byte n x 1024 x 57. You can then separate the different colums using the index array function.
However things could be more complicated if there are sign changes or if the number of chars varies (decreasing under -9.999999 for instance !). There the best approach will be to estimate the offset, then to reacd a few lines and search for the correct time stamp. Ask if you need more help...
Message Edité par chilly charly le 12-27-2005 09:45 PM
12-27-2005 07:24 PM
However things could be more complicated if there are sign changes or if the number of chars varies (decreasing under -9.999999 for instance !). There the best approach will be to estimate the offset, then to reacd a few lines and search for the correct time stamp. Ask if you need more help...
12-28-2005 03:08 AM
12-28-2005 04:56 AM
@aravind_phd wrote:
I'm not able to understand the point where you mentioned about negative data (SIGN Change), cause it seem to be working fine.
The sample block of data you showed has negative values in the second, fourth and sixth columns.
If some of the lines don't have minus signs in in them and that causes the lines to have fewer than 57 characters per line then you cannot reliably use the value 57 to calculate file offsets.