Sponsored Content
Top Forums Programming How to select option for binary coded value? Post 302827801 by Ophiuchus on Sunday 30th of June 2013 07:10:50 PM
Old 06-30-2013
Hello Don,

Initially because is not to complex, I'm trying with Matlab code.

To hecode only from hex to dec the first bytes is easy, but when
the byte is "binary coded" and the descrioption is in a table like I show in previous post, is not a direct conversion, because is based in a table and
I'm don't know if it is better to do several IF's for this.

This is what I have so far.
Code:
fid = fopen('C:\Binary_file');
x0 = fread(fid, [1,1],'*char');% Byte 0, Numeral 1, (ISO coded=Hex)
x1 = fread(fid, [1,22],'*char');% Bytes 1-12, (ISO coded)
x2 = fread(fid, [1,1],'*char'); %Byte 23,(Binary coded B0-B3).
x3 = dec2hex(fread(fid, [8,1])); %Byte 24.

x0 = fread(fid, [1,1],'*char');% Byte 25, (ISO coded=Hex)
x1 = dec2hex(fread(fid, [1,10]));% Byte 26, (ISO coded)

x2=hexToBinaryVector(x1,8);

disp(x2);
fclose(fid);

Thanks for any advice
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Converting Binary decimal coded values to Ascii Values

Hi All, Is there any command which can convert binary decimal coded values to ascii values... i have bcd values like below оооооооооооо0о-- -v - Pls suggest a way to convert this. Thanks, Deepti.Gaur (3 Replies)
Discussion started by: gaur.deepti
3 Replies

2. Shell Programming and Scripting

How to have color coded Terminal display,(like linux)

Hi all, I would like to know how to have a color display in the terminal... In the sense that, In many linux terminals,we have color coded for each file type, green for executable ,blue for dirs and so on... I wanted to know how i can have the same arrangement in solaris(b-79a) I am not... (5 Replies)
Discussion started by: wrapster
5 Replies

3. Shell Programming and Scripting

Select SQL Queries Option

count.sh#!/bin/ksh SQL1=`sqlplus -s usr/pwd @count.sql $1 $2 $3` SQL2=`sqlplus -s usr/pwd @selectall.sql $1 $2 $3` LIST="Count Select_All" select i in $LIST do if then echo $SQL1 elif then echo $SQL2 fi done (2 Replies)
Discussion started by: killboy
2 Replies

4. Shell Programming and Scripting

Simple Script looking for Hard Coded Variables

Hi Guys Looking for a little help with a script to grep all files looking for hard coded variables - ie its IP address... so we know which files to look at before an IP change... This is what I have - but it seems to loop and never end... Any better suggestions? #!/usr/bin/ksh #simple... (2 Replies)
Discussion started by: serm
2 Replies

5. UNIX for Dummies Questions & Answers

Decimal to BCD (Binary Coded Decimal)

Anybody please help me... Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary Coded Decimal) representation. Also, draw its Flow Chart. This is a unix qn... plz post algorithm for that :confused: (1 Reply)
Discussion started by: caramba
1 Replies

6. Homework & Coursework Questions

Decimal to BCD (Binary Coded Decimal)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary... (2 Replies)
Discussion started by: caramba
2 Replies

7. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies

8. What is on Your Mind?

The square root code I coded on this site...

Hi all, (mainly Neo)... I keep noticing that the SQRT code I wrote recently for a POSIX shell keeps appearing, (the green colour sticks out like a sore thumb). So I decided to take a look on Google. Guess what? UNIX.COM comes first in Google's listing just from two words, see image... (2 Replies)
Discussion started by: wisecracker
2 Replies
explain_fread_or_die(3) 				     Library Functions Manual					   explain_fread_or_die(3)

NAME
explain_fread_or_die - binary stream input and report errors SYNOPSIS
#include <libexplain/fread.h> void explain_fread_or_die(void *ptr, size_t size, size_t nmemb, FILE *fp); DESCRIPTION
The explain_fread_or_die function is used to call the fread(3) system call. On failure an explanation will be printed to stderr, obtained from explain_fread(3), and then the process terminates by calling exit(EXIT_FAILURE). This function is intended to be used in a fashion similar to the following example: size_t how_many = explain_fread_or_die(ptr, size, nmemb, fp); ptr The ptr, exactly as to be passed to the fread(3) system call. size The size, exactly as to be passed to the fread(3) system call. nmemb The nmemb, exactly as to be passed to the fread(3) system call. fp The fp, exactly as to be passed to the fread(3) system call. Returns: This function only returns on success, the number read or 0 on end-of-input. On failure, prints an explanation and exits. SEE ALSO
fread(3) binary stream input explain_fread(3) explain fread(3) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2008 Peter Miller explain_fread_or_die(3)
All times are GMT -4. The time now is 07:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy