Binary file read with bit offset..not byte offset.
hi,
i want to read a binary file with some offset ..not in bytes... offset in bits..my data is a single bit data stream size of 1GB ,after skipping particular bit offset i want to read the data in byte order..
Indrajit
| [email protected] | [email protected] .
hi , Gerd W
i am not able to follow your answer.... here with i attached a file to describe my query more clearly. Actually two channels of 1 bit data stream stored in two different files ,and the file size will be more than 10 GB.
i want to delay the channel B by 3 bits and i want to perform bitwise operation between channel A and shifted version of channel B..till the end of the data..
now i am doing this without applying any delay by choosing a small block by block which corresponds to 1 sec of data .
Indrajit
| [email protected] | [email protected] .
Attachments:
bitwsie.png 16 KB
bitwsie.jpg 52 KB
Similar Messages
-
I would like to read in and write physiological data files which were saved by BioPac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/ app156Fi
leFormat/FileFormat.htm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/ app155macffmt/macff.htm).
I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, I was a little unsure which LabView data types correspond to int, char , short, long, double, byte, RGB and Rect. And, since it is for PC I am also assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
Two samples *.acq binary files are attach to this post to the list. Demo.acq is for version 3.7-3.7.2, while SCR_EKGtest1b.acq was recorded and saved with AcqKnowledge 3.8.1, which version number is 41.
I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to i
llustrate it.
Many thanks in advance for your help.
Donat-Pierre
Attachments:
Demo.acq 248 KB
SCR_EKG_test1b.acq 97 KBThe reading of double is also straight forward : just use a dble float wired to the type cast node, after inverting the string (indian conversion).
See the attached example.
The measure of skin thickness is based on OCT (optical coherent tomography = interferometry) : an optical fiber system send and received light emitted to/back from the skin at a few centimeter distance. A profile of skin structure is then computed from the optical signal.
CC
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left...
Attachments:
Read_AK_time_info.vi.zip 9 KB -
I would like to read in and write physiological data which was saved by Biopac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/app156FileFormat/FileFormat.h
tm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/app155macffmt/macff.htm) .
I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, because it is for PC I am assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to illustrate it.
Many thanks in advance for your help.
Donat-PierreOne more step...
short are U16 integer
double are double precision float
bool seem to be 2 bytes (= U16)
char are string (variable length)
rgb are U16 integer, with high order byte = 0
rect should be 4 x U16 (top, left, bottom, right)
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left... -
Hi there,
Here is something I never did, so a little help is welcome
I have a binary file made with VB and I want to read it with LabVIEW 8.5.
I know the structure of the records in the file, it's something like:
str1 As String * 5
str2 As String * 6
str3 As String * 2
date As Date
str4 As String * 20
str5 As String * 20
int1 As Integer
flt1 As Single
flt2 As Single
flt3 As Single
and so on.
Further on there's even a 2D array: 3 rows, 400 cols of singles.
The total length of one record is 5120 bytes.
I can pick up whatever record from the file using the "Set file positions" & "Read from binary file" vi's but how do I convert those 5120 bytes in the correct structure?
I was thinking of a cluster but how do I define a fix string length in LV?
Also, is a cluster the right way to go?
So, like I said any help is welcome
ThanksAlain S wrote:
I was thinking of a cluster but how do I define a fix string length in LV?
Also, is a cluster the right way to go?
So, like I said any help is welcome
Thanks
Defining a fixed sized string officially not possible, and even the non official way will get you bugs, so let's do the official route.
First open up the file with a hex editor, I normally use the Total Commander's built in F3, and then hit '3' to get a hex view. In that view I check wheter the lenght of the string is prepended to the string (Pascal and LabVIEW style) or ended with a Null (C style).
If none of them is happening, I would use a cluster of 5 U8's to get the string, convert this cluster to an array, and convert that to a string.
I have no idea what a 'Date' representation is in VB.
A cluster is very suitable for this task, however I do not get the info about the 2D array, if you could add a data file that would be very helpfull.
Ton
Message Edited by TonP on 28-08-2009 08:44 PM
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! -
Hello everyone,
I am not that comfortable with binary file reading. I am trying to learn.
I have a vi which logs a sine wave in a binary file.
The Read vi which I have written is not giving the expected data.
Thanks in advance
cooldude
Attachments:
Log Data.vi 9 KB
Read Data.vi 10 KBAttachments:
Log.JPG 20 KB
Read.JPG 13 KB -
DNG files created with LR4 do not show thumbnails
Hi,
When using LR3 to create DNG files from my RAW files, those files would show me thumbnails of my image in Windows Explorer. I am running Windows/7 (64) and have installed a CODEC from "Fast Picture Viewer" that allows thumbnails from RAW & DNG files to be shown. It seems, however, that the thumbnails do not show for DNG's created with LR4.
To Remedy this I uninstalled the CODEC. Downloaded the most recent version and installed it but this did not fix the problem.
I then went to the user forum for the CODEC product and searched for my problem. I found a thread who's solution is to turn off "Embed Fast Load Data" when exporting to DNG and it fixes the problem. I tried this and indeed it did fix it. The responder went on to say ".....When this option is enabled the files created are no longer DNGs (just an undocumented private format of Adobe that no one else can read to this date)". This statement surprised me as it is counter to what I understand Adobe created DNG to be. Can I get some input on this comment as if true it is very troubling.
My second question is that I see where to turn off the "Embed Fast Load Data" in the LR Export module, but where do I do the same thing in the Import module when I'm selecting import mode "Copy to DNG"?
And, my thrid question is this. If indeed the DNG files created by LR4 are proper DNG files and this CODEC is just flawed in some way, does anyone have a better way to allow image thumbnails to be shown in Windows Explorer?
Thanks -- DanHi David,
You testing does not coincide with mine. I have consistently kept "Use
lossy compression" turned off. With lossy turned off, it seems that using
Fast Data Load prevents the thumbnails from displaying whereas turning off
"Fast Data Load" allows the thumbnail to be shown.
Below is comment from Adobe confirming that they have yet to release the
spec containing "Fast Data Load".
From: Ian Lyons [email protected]
Sent: Tuesday, June 05, 2012 12:29 AM
To: Califdan
Subject: DNG files created with LR4 do not show
thumbnails
Re: DNG files created with LR4 do not show thumbnails
created by Ian Lyons in Photoshop Lightroom - View the full discussion -
Writing binary files & trouble with no unsigned byte type
I've got a fair amount of Java experience, enough to know what I'm doing most of the time but I do have a vast experience with C & C++ which helps my Java. I've stumbled across a problem when trying to write out files in binary.
If I was to write out a binary file, I would always choose C/C++ to do this because simply because I'm at ease with the implementation.
I've now written a Java program which needs to output a file in binary and I'm having real issues doing the most simple things because of no unsigned support.
I want to write out elements byte-by-byte and make use of the 8-bits provided in the byte type in Java.
Let's assume I've done my processing and I end up with an int. I know that this int is 0-255 in value. I now want to pack it into a byte and write it to my file. How do I go about assigning the byte without Java 'converting' it to a signed byte? I simply want to copy the lower 8-bits of the int and duplicate them into the byte variable - no conversion.
In C you would do something like this:
char mySignedChar = *( (char*)&(unsigned char)myInt ) );
What's the Java equivalent? Am I going about this the right way?Whether a byte is signed or unsigned only matters if one is doing arithmetic on it. If the int is 0-255 then you just cast to a byte using
byte theByte = (byte)theIntValue;When reading back you just use
int theByteAsAnInt = theByte & 0xff; -
I tried to read one line of binary file as the top of the screenshot.
The result is as the left side. It shows the first part with text are correct. The ending part is not match with the raw one.
I also tried read by byte, but still the same.
Any suggestion, thanks.
Solved!
Go to Solution.
Attachments:
shot.JPG 48 KBWhat program created this binary file?
If you can figure out how the file was created, then you can figure out how to read it.
We can't help because all you've shown are some bytes and say that some are right and some are wrong. What is the "raw one" you are referring to? What do you expect it to look like?
Message Edited by Ravens Fan on 01-26-2010 11:15 PM -
Reading a binary file to string variable does not populate correctly
Hi, I am new to Adobe Air/Flex and I'm trying to read a
binary file which also contains text in "cleartext". The problem
I'm having is that when I call FileStream.readUTFBytes method, only
the first 6 characters are showing up in my string variable
"contents" when I debug it in FlexBuilder or use a trace command
and debug it. I have also tried with other types of files but I
have a similar problem unless it's a non-binary file.
Am I doing something incorrectly or should I be reading a
binary file differently than the way I'm reading it currently?
The source code is shown below.
TIA,
Magnus
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import flash.filesystem.File;
private function readFiles():void{
var feedFile:File = File.userDirectory.resolvePath( "Local
Settings/Application Data/Microsoft/Feeds/AppScout~.feed-ms" );
var stream:FileStream = new FileStream();
stream.open( feedFile, FileMode.READ );
var contents:String =
stream.readUTFBytes(stream.bytesAvailable);
trace(contents);
stream.close();
]]>
</mx:Script>
<mx:Button x="121" y="66" label="Button"
click="readFiles()" />
</mx:WindowedApplication>It's difficult to tell what it is, it looks like a binary
pipe symbol but I can copy it from TextPad for example. Some of the
characters following it cannot be copied from TextPad which I
assume is because it's null. I can read the whole file in C#/.Net
and assign it to a string variable without any problems but perhaps
Air is somewhat limited to binary content. -
Hi there,
I'm trying to read a partially binary file with the following structure: The first three lines of the file are regular strings (one can see them correctly when opening the file in a text editor), the rest of the file's contents are integers in their binary form (one cannot see them correctly when opening the file in a text editor).
How can I read such a file?
Thanks in advance!
+P.S.: If you're interested, I'm trying to read a .PPM file (look here to find out about the format).+pfrc wrote:
Hi there,
I'm trying to read a partially binary file with the following structure: The first three lines of the file are regular strings (one can see them correctly when opening the file in a text editor), the rest of the file's contents are integers in their binary form (one cannot see them correctly when opening the file in a text editor).
How can I read such a file?
Thanks in advance!
+P.S.: If you're interested, I'm trying to read a .PPM file (look here to find out about the format).+Use a BufferedInputStream wrapped around a FileInputStream. Read and bytes and until you've hit two end-of-lines, then put those bytes into a String constructor. Note that you'll have to know which line end convention is used, or write your code so as to allow for any of the common ones. After that, continue reading bytes and processing however is appropriate for you. -
If I try to seek (or read) with the position mode wired and set for START, I get error 4 (END OF FILE) if the file is larger than 2 GB. I'm only trying to move the file pointer 4096 bytes, not trying to seek or read more than 2GB, but I get the error if the file is over 2Gig.
Instead, I have to do reads, with the position mode unwired, until I get to the place in the file that I want to be.
Is this expected behavior?Hello,
LabVIEW File I/O functions use an I32 value to store the size of a file. This means that we are limited to ~2GB file sizes when using the File I/O functions in LabVIEW. This explains why you are seeing odd behavior when trying to read to the end of the file, since this is causing the byte count to exceed ~2GB.
I hope this explanation sheds some light on the situation for you. Hopefully the workaround (repeated reads) is not too much of an inconvenience.
Good luck with your application, and have a pleasant day.
Sincerely,
Darren Nattinger
Applications Engineer
National Instruments
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman -
Javascript multiple file upload with progressbar does not work in firefox, please help
I want to upload files using this javascript snipped as well as processing non file fields on the same form. This works beautiful in IE11, Chrome and Opera, but not in firefox (version 34).
I fired the non file handler with the action attribute on the <form> like this:
<form id="upload_form" enctype="multipart/form-data" method="POST" action="nonFile.php">
and the javascript with:
<input name="submit" type="submit" style="background: green" value="Submit" onclick="return uploadFiles()"/>
When I change type="button" the file uploads work in FF but the I have no control over the non file fileds.
Can someone gives me an indication of what is wrong?
oXHR.upload.addEventListener("progress", function(e){
var percent=(e.loaded/e.total) * 100;
_(idProg).value = Math.round(percent);
_(idstat).innerHTML = filename.name + " "+Math.round(percent)+"% --- Please Wait";
}, false);
// Upload finish, show the size of the file in Bytes, KBytes or MBytes
oXHR.onreadystatechange = function(){
if (oXHR.readyState == 4 && oXHR.status == 200){
var iBytesTransfered = bytesToSize(filesize);
_(idstat).innerHTML = filename.name + " Size: " + iBytesTransfered + " "+100+"%";
_(idProg).value = 100;
// Upload failed
oXHR.addEventListener("error", function(e){
_(idstat).innerHTML = "Upload Failed";
}, false);
// Upload aborted
oXHR.addEventListener("abort", function(e){
_(idstat).innerHTML = "Upload Aborted";
}, false)<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0, 0,0" width="600" height="360">
<param name=movie value="example.swf">
<param name="allowScriptAccess" value="always" />
<param name="quality" value="high">
<param name="allowScript" value="opaque">
<param name="wmode" value="opaque">
<embed src="example.swf" quality="high" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=Shockwave Flash" type="application/x-shockwave-flash" width="600" height="360"></embed></object> -
Binary file readed from Labview and Borland C++ v.5
Hi Everybody!
My problem is reading binary file from Labview 7.0 and Borland C++ version 5 is not the same.
Only one difference is "space". Reading from Labview I got "00" (decimal) and reading from Borland C++ I got "32".
I also try to read this binary file with Matlab 6 and I also got "00" as well as those from Labview.
I really struck with this problem.. Anybody has an idea about this problem.
Thanks a lot for anybody help!
NokHi,
These threads regarding reading of binary files was recently discussed in this forum
You might find some answers for your query
http://forums.ni.com/ni/board/message?board.id=170&message.id=99016&requireLogin=False
and
http://forums.ni.com/ni/board/message?board.id=170&message.id=153565&requireLogin=False
Regards
Dev -
Hello All,
Newbie having some trouble with reading a chart from a binary file. My problem may be with trying to use a binary file, I am not sure. The x axis time is not the same length as the actual test time. I have acquired a rms voltage from a VCR RF envelope. I'm using a 6009 DAQ with LV 7.1 on Win2K. I have attached the recording vi and the reading vi and a sample file. I have tried different things including the examples that came with lab view. I need to write a small sized file because this test will last for 4 hours. I have another application that will run for 5 days. I appreciate any help or ideas.
Thanks,
bh3560
Attachments:
Chart write_Read.zip 140 KBHi,
The program you have attached acquires, saves and reads data in ASCII ( floating numbers) and not binary.
To get an idea on how to write and read data in binary format, look at attached examples( taken from examples shipped with labview)
Hope this helps
Regards
Dev
Attachments:
Cont Acq&Graph Voltage-To File(Binary).vi 88 KB
Graph Acquired Binary Data.llb 72 KB -
Hi,
I'm currently using a java.io.BufferedInputStream to read a large binary file.
I recently discovered there is a chunk of data that shows up near the end of each file. (these files are binary and are XX to XXX mb in size)
Loading it all to memory first would kill my performance so I'd like to be able to come up with an alternate method.
Does Java or the class above offer a way I can
1) get the length of the file
2) seek to a point say 2000 bytes from the end so I can start reading the binary data?
Ideally I'd like to do a backwards read as that would be quickest. Is there a way to change the operation so that a 'read' would be reading backwards (from end to beginning)?
For me speed is the #1 thing i have to worry about. So to be able to seek forward several hundred thousand bytes at a time would help tremendously.how does the 'skip' method work? Probably by using OS specific calls to read to a point in the file.
maybe I could
'skip' length - 20k from the start or something like
that.
Yep.
Maybe you are looking for
-
Pages '08 Business Card Template Question
In Pages '08, is there a way to change the business card template page view to a single card view, allowing me to create one card that would automatically display itself in all 10 positions when the layout is changed to multiple card view? This can b
-
Hi all i have a pdf that i generate with FOP then i want to print it in silent mode.I have try the FOAWTRenderer,PDFBox and the basic javax.print but the results are very far from the Acrobat or Foxit print. Any idea for this problem? Thanks
-
how can copy only master datas, i.e customer, vendor, and g/l master data, from one client to another client.what is t-coed,
-
How to create STEP files in Multisim
Greetings, Is there a way to create STEP files from the schematics in Multisim? I need to create a file type that people can access from the server and be able to read without having Multisim on their PCs. This would be for documentation and a
-
All of a sudden my Iphone 4 shut off amd will not TURN ON AT ALL. Ive tried everything from holding the buttons to plugging in the usb to a computer and opening my Itunes. I cant get it to turn on...Please anythoughts??? <E-mail Edited by Host>