LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to display custom data in a file in a graphical form?

The file format is:
       T1Ch1Val0Ch2Val0Ch3Val0 T2Ch1Val1Ch2Val1Ch3Val1 ...
I want display the multichannel data on a Waveform Graph and the X-Axes display the timestamp(T1,T2...)
Who can tell me how to do it or give me some example? Tanks in advance.
 
btw: I am a beginner of labview.
0 Kudos
Message 1 of 11
(3,301 Views)
The first step in solving this problem is to first read the data. In order to do that you need to specify the format of the data. What's the format of the timestamps? What's the format of the channels? What's the format of the values? What are you using to read the data?

I would recommend looking at the examples that ship with LabVIEW on waveform graphs as they show you how to write up a waveform graph. I suspect, though, that since you have individual timestamps you'll probably want an XY Graph.
0 Kudos
Message 2 of 11
(3,280 Views)
Is the file a text file or is it binary? Are the values run together or are they separated in some well defined way? What separates the T1 group from the T2 group? Are the values in integer, fractional, exponential, or some other format?

After the data has been read from the file, parsing may be easy or difficult depending on the answers to the questions above. Once parsed it should be relatively easy to display the data.

Lynn
0 Kudos
Message 3 of 11
(3,279 Views)

My guess would be that a couple of nested loops and the Spreadsheet String to Array primitive will help you do what you want, but I suggest you upload a sample file, so that we can give a real answer.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here, here, here, here, here and here are a few you can start with and here are some tutorial videos. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).

Message Edited by tst on 07-17-2007 07:30 PM


___________________
Try to take over the world!
0 Kudos
Message 4 of 11
(3,276 Views)
If you could post a typical dataset it would be very helpful also...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 11
(3,259 Views)

attatch is the sample data.

/* sample code simulated to generate the sample data */

#include <stdlib.h>
#include <stdio.h>
#include <time.h>

#pragma pack(4)
typedef struct _sample_data{
 double timestamp;
 int  c1;
 int  c2;
 int  c3;
}sample_data;
#pragma pack()

int main(int argc, char* argv[])
{
 int i;
 sample_data s;
 FILE *f = fopen("sample.data","w+b");

 srand( (unsigned)time( NULL ) );

 for(i=0; i<1024; i++)
 {
  s.timestamp = i*1.0/1024.0; //the time interval is not constant in actual envionment.
  s.c1 = rand();
  s.c2 = rand();
  s.c3 = rand();
  fwrite(&s, sizeof(sample_data), 1, f);
 }
 fclose(f);
 return 0;
}

0 Kudos
Message 6 of 11
(3,240 Views)
Since your data is in a binary file you need to use the Read From Binary File function. Once you have the data you can graph it any which way you want. See attached for an example (LabVIEW 8.20).
0 Kudos
Message 7 of 11
(3,229 Views)
Thanks for your help. Unfortunately my labview is 8.0, can't open the example.
0 Kudos
Message 8 of 11
(3,202 Views)
0 Kudos
Message 9 of 11
(3,194 Views)

Thanks.

If the data came from ehernet,i want to dynamic display the data in realtime,how to accomplish it.

 

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