Read binary file made with VB
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
Thanks
Alain 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!
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... -
Can Mac read a dcr file made with win?
Hello,
Can Mac read a dcr file made with win?
Thanks in advance.Thanks Sean,
I posted the question because of some problem of user to read the web page with dcr.
You assumed right, it is e dcr hosted in a browser page and viewed via shockwave with safari.
I don't know the nature of the problem but the user get an error.
Maybe I must decide to buy a mac and do some test.
Thank you again. -
How to open and read binary files?
How do I open and read Binary files?
Did you look on The Unarchiver's web site where it has a link to older versions? http://theunarchiver.googlecode.com/files/TheUnarchiver3.2_legacy.zip
The best thing to do is ask your friends what programs they used to produce these files, or at least what format files they are producing. Otherwise it's like being shown a car and given a bundle of 200 keys with no idea to which one to use, or even if any of them work with that car.
Using The Unarchiver will likely not do anything because it too will not know what format files are involved, and they may not even been in an archived format. If they sent you a Word file without telling you (a favorite of Windows users to do -- it drives me crazy when they could have just sent them in plain text), The Unarchiver won't open them. If it's a picture file then using Hexedit will just show you a bunch of unintelligible stuff as shown in an earlier post, though you may see a line of text providing a hint.
As I said earlier, often .bin may be an executable program which needs another program to actually interpret it. That's what Java is trying to do. Still, it may think it can execute the file, but it is highly unlikely somebody would send you an executable program (and if they did I would not trust it). For all you know it may be a Windows virus. -
I can't open a 32-bit HDR file made with Photoshop HDR in Lightroom.
I can't open a 32-bit HDR file made with Photoshop HDR. I saved the file in Photoshop with the maximum compatibility-option on. In Lightroom the file doesn't show a preview and an exclamation mark in the upper right corner. Anybody an idea why and how to solve this problem?
As I said, the files must be saved in TIFF format in order for LR to recognize them.
Here's a video tutorial I've recorded explaining the workflow: Tonemap 32 bit images in Lightroom 5
mh++ -
Camera-raw plugin for NEF files, made with the new Nikon D7200
Hi, does anyone know when there will be a camera-raw plugin for NEF files made with the new Nikon D7200?
I think that camera is too new. Even the DNG converter will not support it. If you have Nikon software with the camera, you could convert to tiff and then use the tiff files in Elements whilst awaiting the next Camera Raw update for PSE13.
-
Read binary file in LabVIEW 2012
Hi,
Have anyoune experienced problems reading binary files in 2012 previously saved in 2010.
As shown on attached image, the same VI is opened in 2010 and 2012 reading the same binary file containing the data structure "ProcessList IN".
I suspect it has something to do with the variants ?
The error message does help a lot (-;
Any ideas ?
Kind regards
Kahr
Regards Kahr
Certified LabVIEW Architect
CIM A/S
Attachments:
Read_Binary_File_Error_LV2012.png 426 KBHi Kahr,
"error 1" tells one of the input parameters is wrong: it's either the path or the cluster datatype! The error message only mentions a file path AS AN EXAMPLE!
You're using BinaryRead similar to those old Datalog file functions to read a cluster of several data. It has been know that datalog files get tricky when one is using a different LabVIEW version to read them due to changes of internal data representation. Maybe that's the point that hits you now?
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Can video files made with a Canon XA-10 be imported into FCPX?
Files made with a Canon XA-10 do not seem to be recognized by FCPX.
Recording system of camcorder is MPEG-4 AVC/H.264.
Is there a format problem or a media conversion that needs to be made?
Thank you.
JohnTom is exactly right. Connect the XA10 to the computer using the USB cable that came with it. Then go File > Import from Camera.
Up will pop the import from camera window, which should show two cameras -- your Mac's built-in iSight camera, as well as your XA-10. And you should see the thumbnails from all the various videos you've shot with the camera. Just select the ones you want to import and click Import.
FCPX will begin importing (and transcoding) the videos. Do not disconnect the camera while this process is unfolding (it may take a while depending on how many videos and how long the videos are). -
Trying to import a .mov file made with gotomeeting - no problems in past doing this. After 3 attempts recording the hour long video and trying to upload it to iMovie, it says No importable files -None of the selected files or folders can be imported. Change the selection and try again. What could the reason be?
After much research and troubleshooting, GoToMeeting replied with the final answer: We do not support the uploading of recordings to editing software. If you are having issues uploading a recording, unfortunately, we do not have tools or steps to resolve this. It is not a supported feature. I am sorry for any inconvenience this may have caused you.
The no longer plan to support editing of recordings made with their software. So, we are planning to find a new meeting provider. -
Read binary file 10 bytes at a time
I want to read binary file in a specific format. There is a number at the starting of the file. That tells us where the data is starting. Suppose it says 3975, then it mean data starts at 3975. Then once I read that location I want to read data at 10bytes at a time and then convert it to numeric and display it on graph. I am attaching the file format and the current vi which I am using. please help.
Solved!
Go to Solution.
Attachments:
topo.zip 89 KBAh, the first 10 characters are a string!
After opening the file, use the Read From Text File with count set to 10. Then use the Decimal String to Number to convert this string into your "record size".
NOTE: The text indicator was just for debug purposes. You don't really need it.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Read record size.png 12 KB -
Labview 8.2 Read Binary File, no pos offset option anymore?!
I have a VI that worked perfectly well in 7.1 and now I've opened it in 8.2 it doesn't work and I can't revert back to 7.1 because I accidently pressed save.
In 7.1 I used the combination of open, read and close file functions to read parts of a large binary data file - I cannot read the whole file into Labview 8.2 as it fills the memory. There isn't a terminal in the 'read binary file' function in 8.2 for 'pos offset' which is what I used to use in 7.1. How am I supposed to open the file now? Surely they have not removed such a useful facility entirely - is there another way to do it that I am not aware of?
Many thanks in advance for help,
Sarahsmercurio_fc wrote:
André, at first I could not understand your response, ...
Must be my Dutch way of writing English
Regards,
André
Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl) -
Hi
I need some help in reading binary files. This is the code I have so far.
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class patternmatch {
public static void main (String[] args) {
final byte[] bytes = new byte[1];
try {
final InputStream instream = new FileInputStream (args[0]);
while (true) {
final int count = instream.read (bytes);
if (count==-1) break;
System.out.println(bytes);
instream.close();
} catch (IOException e) {
System.err.println(e);
}Instead of a list of hexadecimal numbers that I want I get a long line of
[B@eee36c
[B@eee36c
[B@eee36c
[B@eee36c
Which represents some address I think.
Does anyone know how to extract the hexidecimal numbers?
Thanks
Charlesdouble post http://forum.java.sun.com/thread.jsp?forum=31&thread=558802
-
HT202879 How can I open a file made with old version of Pages (before 09)?
I need to open a file made with old version of Pages (before 09). How can I do this? I only have iworks Pages free with Mac Book Pro.
You need either Pages '09 or the original Pages '08? programs.
With Pages '09 you simply open it and it accurate converts it to Pages '09. Pages 5 will open the Pages '09 version but may alter/damage the file.
With Pages '08 you Export it to Word .doc/.docx with mixed results, then open that in Pages 5 which may alter/damage the file.
Peter -
Opening Cr2 file made with Canon g11 in Elements 7
Recently I purchased a G11. Elements 7 won't open the raw files created with that camera. I get an error message saying wrong type of file.
Elements 7 opens cr2 files made with my Canon Rebel (3 years old)
Ideas?Download and install the Camera Raw 5.6 update: http://www.adobe.com/support/downloads/detail.jsp?ftpID=4626
Juergen
Maybe you are looking for
-
I have got an Issue with exported videos through Premiere Pro CS3. I know I am using an old version but I felt no need to upgrade. I am facing an issue I haven't faced before. I am exporting a video (no footage, just one music track with still images
-
I've defragmented the iPod HD and optimized its directory. Anyone else?
I have these two applications I use for my MBP and external FW drive: 1. iDefrag. For defragmenting HD 2. Disk Warrior 4 (for Intel). Respected directory repair program. Having successfully used these two apps with my normal computing devices, and se
-
Firefox frequently crashes on any page, maybe because of plugin-container.exe
Firefox seems to be randomly crashing with no regard to what page I view. It can be anything from a Google results page to a page with multimedia playing. Every time, I get the same crash report, but I don't know how to fix the problem. To my knowled
-
Select query on two Database views
Hi all, Can i fetch the data by writing a select query on two DATABASE VIEWS Because i am able to fetch data by writing a selct query on ONE DATABASE VIEW and ON TRANSPARANT TABLE but i am not able to fetch data by writing a query on TWO DATABASE VIE
-
Why does it take more space for pictures to be stored in iPad than iPhone?
Why does it take more space for pictures to be stored in iPad than iPhone? The same pictures in iPhone utilises half the storage space than in the iPad.