LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data from the same source appears differently when plotted in MatLab or LabView

I inherited a LabView application that is reading in data over 38 channels and is dumping that data into a .bin file.  I modified the program so that the data stream also goes to a .dat file for use with some analysis I am developing in MatLab.  One of the 38 channels is recording from a simple mechanical switch that goes between high and low (with some transcience and noise, but on the whole it functions as a step function).  However, when I plot that channel in MatLab it appears differently from the display given in LabView.  While the gross form is the same (both show basic step functions with the same number of high regions), the duration and timing of the high regions is different between the two (and the timing is not always different by a consistent amount of time within the same data set), as well as a lot more noise on the signal is visible in the MatLab plot (including some short duration high spikes that are not visible in LabView).  I suppose my question therefore has several parts:

1.) Is the LabView plot function entirely accurate?
2.) Is there a reason why a data stream might write different data to a .bin and a .dat file?
3.) Is there an easy way to view the contents of a .bin file in tabular form to see the actual values of the data points for direct comparison with the data points of the .dat file?  I am not particularly handy with using LabView yet, so all of my attempts at this have come to naught.

Thanks for any help you can render.
0 Kudos
Message 1 of 22
(3,625 Views)
I miss one question:
Is the Matlab plot function entirely accurate? Smiley Wink

Could you show some screenshots of the mismatching data.
It is usefull to take a look at the raw data so you can see if the spikes occur.
Experiment with the different plot styles of LabVIEW, for instance try a style with no line, only dots at the location of points.

Show the conversion code from .bin to .dat.
I am not sure what kind of data a .bin file is (or .dat for the matter).

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 22
(3,623 Views)
More than likely you're not feeding the data to the graph properly. Please post the data you're trying to plot and how you're plotting it with both Matlab and LabVIEW.

After more than 20 years I would think that the LabVIEW graphs would prove to be accurate! Smiley Very Happy
0 Kudos
Message 3 of 22
(3,619 Views)
Ok, so far I have submitted two replies with screen shots, neither of which have appeared.  I'm a little disconcerted, because usually I'm not this bad with computers...

So, here goes a reply without attachments to see if it appears.

That is a fair point that I suppose I should have asked if MatLab is accurate.  However, I figured people here would be more privy to information about the accuracy of LabView rather than MatLab, and I have more experience with MatLab so I am more comfortable with its capabilities.  No offense was intended.

There is no conversion code from .bin to .dat, I simply take the data stream from the input and send it simultaneously to two different files (one is a .bin, the other a .dat).  If I understand it correctly, a .bin is a LabView binary file (similar to a .mat file for MatLab), while a .dat is a more generic data file which in this case is a comma separated file of numbers (as opposed to a tab separated file, which is the default from LabView).  The reason for creating two different file types is simply because the original framework of the data collection and analysis was done primarily with LabView and Excel, all of which functioned using the .bin file.  Thus, if I want to use any of the existing data processing tools that have already been developed for the lab, I need the .bin file.  However, the data processing that we are currently attempting to develop are more involved and it seemed like it would be more suited to development in MatLab.  Since I am much more familiar with MatLab than LabView, I decided it would be easiest to start completely with the raw data taken at the same time as the .bin file was formed, but to do so I needed it in a MatLab friendly format (hence the .dat).

I will try experimenting with the different viewing options.  Thank you for the suggestion.
0 Kudos
Message 4 of 22
(3,600 Views)
All right, I'm not doing anything differently with the attachment messages (except putting something in the attachment box below).  I'm not familiar with these forums, so is there something else that needs to happen before I'm allowed to post messages with attachments?  Or is there something else I'm supposed to click other than Submit Post after I add attachments to it?
0 Kudos
Message 5 of 22
(3,598 Views)
A .bin file is not inherently a LabVIEW binary file. It's just a file with a .bin extension. Any program can read it, as long as the way the binary data was stored is known.

Are you trying to preview the posts before you submit them? If you try to preview the post the attachments get lost.
0 Kudos
Message 6 of 22
(3,595 Views)
That's true about the .bin file, although in this case I was under the impression that it was essentially a LabView only file since it is the only program I know of that knows how to read the binary data it created.  Do you know of any other programs that know the way LabView stores binary data?

As for submitting posts with attachments, I am simply typing the post, adding the attachments, and then clicking on the "Submit Post" button.  I wasn't previewing the post, which I suppose turns out to be a good thing.  Ironically, if I could attach a screen shot I could point out exactly what I was clicking...

Thanks for your help so far.  Any ideas on why attachments won't go through other than being removed from hitting "Preview Post"?


Message Edited by Mozglubov on 06-02-2008 08:47 AM
0 Kudos
Message 7 of 22
(3,556 Views)

@Mozglubov wrote:
That's true about the .bin file, although in this case I was under the impression that it was essentially a LabView only file since it is the only program I know of that knows how to read the binary data it created.  Do you know of any other programs that know the way LabView stores binary data?

LabVIEW does not store binary data in any "special" way. If the standard "Write Binary File" functions are used, it writes out the data directly. In the case of arrays and strings there's the option of prepending the size of the array or string as a 32-bit integer. More complicated elements, like clusters, are saved a little differently, but not too differently from standard C "struct"ures.

If, on the other hand, the "Write Measurement File" functions were used, then it's a different matter. These do have a specific format. However, once you know the format, you can read it with any programming language.


As for submitting posts with attachments, I am simply typing the post, adding the attachments, and then clicking on the "Submit Post" button.  I wasn't previewing the post, which I suppose turns out to be a good thing.  Ironically, if I could attach a screen shot I could point out exactly what I was clicking...

Thanks for your help so far.  Any ideas on why attachments won't go through other than being removed from hitting "Preview Post"?

Certain attachment types are not allowed. For instance, a file with a .bin extension would not be allowed. If that's what you're trying to do, then place it into a ZIP file and attach that. Other than that, I don't really know. A few people have had problems with attachments in the past, and in most cases it's been browser-related. I would suggest contacting the forum moderators. You can do this by clicking on the "Options" link that appears in the message header and selecting the "Report to Moderator" menu item.

0 Kudos
Message 8 of 22
(3,547 Views)
Ah, I see.  I am using FireFox, perhaps I'll try Internet Explorer and see if I am able to post those screen shots.  Well, I guess if I need to zip the bin file, I might as well just go about zipping everything together, screen shots and all.

Thanks.
0 Kudos
Message 9 of 22
(3,542 Views)
Well, I use Firefox, and I've never had a problem with attachments. Unless the files were of the "verboten extension" kind. Smiley Wink
0 Kudos
Message 10 of 22
(3,537 Views)