LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

converting excel file to waveform graph in PDA

Hi, may i know is there any way to convert lvm/rtf file to display as a waveform in Pocket PC? 
 
Thanks!
0 Kudos
Message 1 of 32
(15,288 Views)
Hmeiz-

Yes you can read from .lvm files in teh PDA module, since they are just text files. However, it is going to take a decent amount of work in order to correctly read and parse the text file. If you want an example of the code that is generated by the Read from Meausrement File Express VI, you can always configure it and then right click and select Show Block Diagram. The code is quite extensive, and some of the functions used are not supported on the PDA target. Your options are:

Modify the code generated by the express VI to work with PDA (this should be possible, but it might take some time)
Write your own reader using the Read from Text File VI's. If you are reading from a known LVM file this could be much simpler

My recommendation, just use a csv.

Xaq
0 Kudos
Message 2 of 32
(15,228 Views)
But if i use the Read from Text File function, it cannot read the lvm file. It can only read from the rtf format, but it doesn't display the graph correctly...Can u help look at the sample code i have?
Say i want to display the attached word file. Btw, i'm using a Pocket Pc 2003.
 
Thanks,
 
 
Download All
0 Kudos
Message 3 of 32
(14,775 Views)
You are conflating the read from text file and read from spreadsheet file ideas.  Read from text file is a very low-level function that simply reads bytes out of the file and interprets them as a text string.  In your case, this is a correct assumption, since an LVM file is a text file.  However, this string must then be decoded into binary to plot to a graph.  Read from spreadsheet file reads in text and decodes it to binary in one operation, but assumes there is no header data.  In the case of the LVM file, you need to remove or decode the header before you try to decode the data.  The LVM file format was designed to make this easy.  If you just want the data, search for the "***End_of_Header***" tag twice (once for the file header, once for the data header).  The text afterwards is your data, with column headers.  Strip the column header by searching for the end-of-line (you may have a stray end of line from searching for the end-of-header tag).  This will leave you with a text string that contains only your data.  Run this through the spreadsheet string to array primitive and you are ready to graph.

Let us know if you need more help.
0 Kudos
Message 4 of 32
(14,319 Views)

Sorry but i'm kind of confused. How do to strip the headers? Where do i start? and i've tried using the Read from Spreadsheet file function, but it doesnt work on a PDA.

Thanks again!

0 Kudos
Message 5 of 32
(14,186 Views)
The attached file shows the process.  I could not test it because I do not have the LV8.0 PDA module on my machine.  It looked OK under LV8.2.
0 Kudos
Message 6 of 32
(14,127 Views)
Ya, it works on a normal vi but it doesnt work when i import it into the Pocket PC vi. It doesnt display anything. Thanks for the vi, though i dont quite understand when it gets to the back. What are the index arrays and bundle for?
 
Thanks for the help! 
0 Kudos
Message 7 of 32
(13,919 Views)
There may be some issues with actually getting the code to run on a pocket PC.  I rewrote it using the standard PDA templates in 8.2 and verified that it ran and displayed properly on my Dell Axim x50v (PocketPC 2003).  I saved for previous for 8.0 and zipped it up.  It is attached below.  I made the following changes:

  1. Changed the graph to a PDA graph
  2. Changed the file open to the PDA version (got warnings on compile with the standard LV version)
  3. Wrapped it in a run/exit loop structure from the default template
  4. Changed the file extension to .txt, although this is not necessary since the browse file dialog shows everything.  Note that the initial browse may take awhile.  I don't know why, but I have run into this on other programs on my PDA.
Hopefully that will work for you.

At the end of the read, after the column headers are stripped, the data is converted from text to binary (DBL, probably not the best choice for a PDA, SGL would be better, given the data resolution in an LVM file).  The resultant array is then transposed so there are two columns of data rather than two rows of data.  This is not necessary if the indexing in the next step were done correctly.  The first data column contains the time data.  The second contains the Y values.  The time is evenly spaced, so the spacing is determined by subtrating the second time value from the first after indexing them from the 2D array.  The Y values are extracted as a single column from the 2D array.  The initial time value, time increment, and Y values are then bundled to properly display on the graph.  A waveform data type could also have been used, but I was initially unsure of whether waveforms were supported on the PDA (they are).

If you have any more questions, let me know. 

P.S. I assumed your PDA had a portrait 240x320 screen.  You can modify the front panel to produce what you really have.  The current GUI is pretty ugly.
0 Kudos
Message 8 of 32
(13,743 Views)

Hey DFGray, thanks for the vis. Now the data can be displayed when i run the vi in the Pocket PC, but values are incorrect. The graph does not read values that are negative or below 0, it just displays values from 0 to 10 in the y-axis. Is the vi meant for stripping headers from file generated from "Write to Measurement file" function? Because if i read file generated from "Write to Spreadsheet file", it doesnt display anything.

Once again, thanks for the help!

    

0 Kudos
Message 9 of 32
(12,654 Views)
Off hand, I am not sure why you are unable to read in negative values. Have you tried manually setting the minimum and maximum Y-Axis values on your Waveform Graph to range from -10 to 10? If this behavior persists, we may have to look deeper into what is going on in your LabVIEW PDA application. Can you construct a very simple test application (read in an LVM file and display on a graph only) that shows this problem, and then attach the VI to your next post?
 
It looks like the previous VI posted (LVMonPocketPC.vi) is indeed stripping header information from LVM files. This explains why the VI doesn't appear to read in data written with the Write to Spreadsheet VI.
 
I hope this helps!
 
Casey Weltzin
Applications Engineer
National Instruments
0 Kudos
Message 10 of 32
(12,369 Views)