LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to open an lvm file in MATLAB Script Node

Hello everyone
 
I am using LabVIEW 8.0 in order to acquire a signal, and I chose to save the signal's data with "Write to Measurement File"
Here is the problem, later on I am using a MATLAB script on the data, but the problem is that the MATLAB can't read the lvm file, because it doesn't have a txt ending.
So my question is this : is there any way I can convert in LabVIEw the lvm file to txt ???
Thanks ,
Lavi
0 Kudos
Message 1 of 8
(12,345 Views)
The easiest way is to simply change the file extension from "lvm" to "txt".  The file is already a simple tab-separated text file.  You can get the spec here, so you know how you have to parse it in Matlab.  It was designed to be easy to parse.  Let us know if you need more help.

NOTE:  LabVIEW will still read it correctly, even with a txt file extension, so you really don't lose much by doing this.
0 Kudos
Message 2 of 8
(12,328 Views)
Edit: Sorry about the double answer on the .lvm file. Posted at the same time as previous answer.

The .lvm file is a text-based file. Form the online help for LabVIEW :

Use text-based measurement files (.lvm) to save data that the Write To Measurement File Express VI generates. The text-based measurement file is a tab-delimited text file you can open with a spreadsheet application or a text-editing application. In addition to the data an Express VI generates, the .lvm file includes header information about the data, such as the date and time the data was generated. LabVIEW saves data with up to six digits of precision in a .lvm file. Use binary measurement files (.tdm) to exchange data with higher precision.

A few comments regarding your code:
  • Learn to stop using sequence frames. This is typical for someone coming from a text-based language programming environment. This is not a personal knock on you, just a pointer. For example, instead of using the "Wait (ms)" function you can use the "Time Delay" VI. That has error in/error out clusters which will allow you to chain VIs. In the bottom part you can eliminate the sequence frame that you're using the parallel port write to the following:

    which is much cleaner and easier to read.
  • The loop where you're reading data is pointless. It is set up to run only once, so what's the purpose of a loop?
  • You do not need to place all objects inside a sequence frame and then place the sequence frame inside the loop. This is redundant.

Message Edited by smercurio_fc on 04-19-2007 09:26 AM

Message Edited by smercurio_fc on 04-19-2007 09:27 AM

0 Kudos
Message 3 of 8
(12,328 Views)
I know the simplest way is to change the file extension from.lvm to .txt but I need to change it in "real time", which means I need to change it in the vi itself !!!
0 Kudos
Message 4 of 8
(12,318 Views)
Then just rename the file after you've created it using the "Move" File I/O function.
0 Kudos
Message 5 of 8
(12,316 Views)

Can you please implement it on Single Session 19 04.vi ???

when I tried to implement it on the vi it worked, HOWEVER when I use it as a subvi in it gives me an error on the second time it works in the iteration.

Thanks,

Lavi

0 Kudos
Message 6 of 8
(12,309 Views)
I don't quite understand what you're saying. You say "when I use it as a subVI". When you use what as a subVI? The VI you originally posted? That's not too surprising since the design of that VI needs to be redone. Those loops don't do anything.

As for the file renaming, why don't you just use the name "sensor.lvm" for the textread function in your Matlab code, rather than "sensor.txt"? I don't believe that the textread function requires that the name of the file end in .txt. It just wants a filename. This would eliminate the need to rename the file.
0 Kudos
Message 7 of 8
(12,298 Views)

Yess! I love you! I just opened .lvm file with my notepad... I just thought I will never get my data in visible form and I'll have to redo my measurments over again. I love you! Wish you the best!

0 Kudos
Message 8 of 8
(10,010 Views)