Jump to content
Sign in to follow this  
Rahul Karthik

Reading a Binary File containing Cluster Data

Recommended Posts

Hi,

 

I created a Binary Data file that stores cluster data. It is a cluster of 3 element..

 

1. Unsigned byte - 8 bit integer

2. Double - 64bit real

3. Double - 64bit real

 

This cluster of 3 elemetes is actually represented in the form of a waveform graph w.r.t time which I saved as a Binary File...

(For the .dat file click here http://www.mediafire.com/?u4c1y9iho2b5qoe )

 

Now I want to read this binary file in labview and display it in the form of a graph.

 

I cannot post the VI for creating the binary file because It requires Control system, Fuzzy toolbox but here are the parameters I used

 

Byte Order - Little Endian

 

See the attachment for my try for reading the binary file... Please help me with the reading of the .dat file I linked above

 

If there is anything I have to tell, let me know

 

Thanks

read.vi

Share this post


Link to post
Share on other sites

The "Data Type" terminal in the read defines what the data type out will be.  You wired a constant of a string with the value of 0.  This tells the read VI that the data in the file is a string.  You should wire your cluster to the data type terminal, then the output will be that cluster.

 

EDIT: Also if you wire a -1 to the count terminal it read the whole file.  When I ran you VI it gave an end of file error so they way you were calculating the remaining bytes was incorrect.

Edited by hooovahh

Share this post


Link to post
Share on other sites
Yup.

What hoover said.

 

attachicon.gifread.vi

Sorry if this is off topic but this is the second time you have called me by my name (sorta) do I know you?  How do you know me by my name?  And not that it bothers me but could you please refer to me as "hooovahh" (or hoovah if you don't count the correct number of letters) other members may only know me by my alias and I think it was be easier if we referred to each other by our internet names.

Share this post


Link to post
Share on other sites
Sorry if this is off topic but this is the second time you have called me by my name (sorta) do I know you?  How do you know me by my name?  And not that it bothers me but could you please refer to me as "hooovahh" (or hoovah if you don't count the correct number of letters) other members may only know me by my alias and I think it was be easier if we referred to each other by our internet names.

Nope. Don't know you or what your real name is (a hoover is a vacuum cleaner over here and in everyday usage). It was, and always will be a typo (apologies).

 

My handle, however, IS my real name. (I don't care how you spell it and even I get it wrong sometimes whilst typing. Luckily I rarely refer to myself in the third person ;) )

Edited by ShaunR

Share this post


Link to post
Share on other sites
Nope. Don't know you or what your real name is (a hoover is a vacuum cleaner over here and in everyday usage). It was, and always will be a typo (apologies).

 

My handle, however, IS my real name. (I don't care how you spell it and even I get it wrong sometimes whilst typing. Luckily I rarely refer to myself in the third person ;) )

Oh my apologies.  A Hoover is a vacuum in the states as well.  However when I say my name is Hoover people some times ask "How do you spell that, like the vacuum?" I say "No like the president".

Share this post


Link to post
Share on other sites
Oh my apologies.  A Hoover is a vacuum in the states as well.  However when I say my name is Hoover people some times ask "How do you spell that, like the vacuum?" I say "No like the president".

 

You should really say "No like the president"

Share this post


Link to post
Share on other sites

Thanks a lot Hooovahh and ShaunR,

 

When I display the graph the range is limited to the last 1000 points on the X-Axis, Where as I want the complete data to be read and displayed

(Starting from time (x) = 0 till last point of the x-axis)

Share this post


Link to post
Share on other sites

Right-click on the chart, choose "Chart History Length..." and set it to a number large enough to cover all your data (right now it's set to 1000). Or, use a graph instead of a chart.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By GregFreeman
      Edit: found this in context help: Arrays and strings in hierarchical data types such as clusters always include size information.
       
      http://forums.ni.com/t5/LabVIEW/Write-to-Binary-File-Cluster-Size/td-p/3199224
       
      I have a cluster of data I am writing to a file (all different types of numerics, and some U8 arrays). I write the cluster to the binary file with prepend array size set to false. It seems, however, that there is some additional data included (probably so LabVIEW can unflatten back to a cluster). I have proven this by unbundling every element and type casting each one, then getting string lengths for the individual elements and summing them all. The result is the correct number of bytes. But, if I flatten the cluster to string and get that length, it's 48 bytes larger and matches the file size. Am I correct in assuming that LabVIEW is adding some additional metadata for unflattening the binary file back to a cluster, and is there any way to get LabVIEW to not do this?
    • By Hack4Life
      Hello,
      I need to select a .csv file which has two integers seperated through a comma per line. I have to sume these to values and write it to a new .csv file with the two integers and as third position the result. I have a path selector and a read from spreadsheet and a write to spreadsheet element. But I do not know how to read the two values line per line and add those to values with the result in a new .csv file. 
       
      For example:
      input:
      A,B 1,3 2,6 3,3 output:
      A,B,C 1,3,4 2,6,8 3,3,6 I hope that somebody can help me.
       
      Thanks for your help!
      Greets from Austria,
      Fabian
    • By Manudelavega
      Hi,
       
      I can't get my head around this issue. Let me lay out the scene:
       
      My application logs data in a .csv file. The file is created with R/W permissions through the "Open/Replace/Create File" VI.  Then it uses the "Write to Binary File" to log the data, keeps the reference opened all along, and only close the file at the end.
       
      So far everything works perfectly. If I double click on the file in Windows Explorer, Excel sees that the file is being opened in LabVIEW and shows the typical message giving me the following choice: Read-only, Notify, or Cancel. If I cancel, Excel closes and things keep on going fine.
       
      However, if I do click "Read only", the "Write to Binary File" function in my LabVIEW application throws an error 8: File permission error. Somehow opening the file as read-only in Excel steals the write permission of LabVIEW.
       
      Have you ever experienced this? What could be happening?
       
      Emmanuel
    • By smarlow
      Hello:  I am wondering if anyone has developed a VI to convert image data from the "Get Image" method to a PNG format string.  I do not need compression or filtering and will only store RGB (24-bit), or paletted 8-bit (optionally, but not required).  The trouble I am having is that the "write PNG file" and "LV Image to PNG" VI's are not supported in real-time.  The BMP file writer works, but is not really a web format.  I suppose I could write one, but I am under the gun on a project, and don't want to reinvent the wheel.  Thanks.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.