**Convert varying hex string to array of 8 and 16 bit numbers**Hi
I have a data string that I'm reading from a file. The format of the string is as follows:
a bB cC dD eE fF gG hH iI j kK/r
each letter is an 8 bit character. The capitol letters are high bit of a 16 bit number.
I have a sample that works. It converts all the characters to an array with eleven rows. My problem is my files usually have a million data points or more and it takes a while for my VI to execute.
I've attached a sample file and an example VI with 3 possible ...

**How to copy an 8 bits array into a 16 bits array?**Hi,
I need a fast code which copies an 8 bits array, into a 16 bits array.
I have now:
char* src;
short* dst;
int i,size;
for( i=0;i < size; i++)
dst[i]=(short)src[i];
I am not familiar with pentium assembly.
Any suggestions?
thanks,
Moshe
On Thu, 16 Dec 2004 20:33:12 +0000 (UTC), spamtrap@crayne.org wrote in
comp.lang.asm.x86:
> Hi,
> I need a fast code which copies an 8 bits array, into a 16 bits array.
> I have now:
>
> char* src;
> short* dst;
> int i,size;
>
> for( i=0;i < size; i++)
> dst[i]=(short)src[i];
^^^^^^^
This is a redundant...

**Convert ctypes 16 bit c_short array to a 32 bit numpy array**
I'm using ctypes to have a dll fill a buffer with 16 bit data. I then
want to convert this data to a numpy array. The code snippet below
converts the data from 16 bit to 32 bit, but two 16 bit numbers are
concatenated to make a 32 bit number and half the array is zero.
Buffer = (c_short * byteSize)()
self.cam.Qframe.pBuffer = cast(pointer(Buffer), c_void_p)
perr = self.cam.GrabFrame()
image1 = np.frombuffer(Buffer, int)
xdim = self.cam.Qframe.width
ydim = self.cam.Qframe.height
image2 = image1.reshape(xdim, ydim)
imag...

**converting 8 bit image array to 16 bit?**Hi there....
i've got an structure wich is like an pointer to 320*240 array wich is
8 bit image...
i've got also stored its color pallate in some other structure....
i was willing to port this to another platform and like to use it
under 16 bit color display....
i only know that i have an address for start of that 16 bit memory
address to put values in...but i dont know how to convert those 8 bit
indexed colors to 16 bit?
Thanks
Roozbeh GHolizadeh wrote:
> Hi there....
>
> i've got an structure wich is like an pointer to 320*240 array wich is
> 8 bit image...
>...

**Hex String to Number to Array... I think...**Hello to the group,
Here's my dillemma...
I'm interested in a specific output from my device. The expected output is 256 values, as a row of 512 byte (Hex). To simplify communication, I used the LabVIEW Serial VI and added a terminal at the "Read String". This outputs a string (when displayed as "Hex Display") like 0200 0200 ... ... 0200 0100. I wired that output into the "String" input of a Hexidecimal String to Number conversion. Then, I am using a Build Array, wired into the single element. Finally, the app...

**save 16 bit array as image**Hello,
I am a new labview user. I am trying to save an image which is being
correctly displayed on the front panel of my program as an intensity
graph. I am able to get a 2D array of the pixel values (using the
variant to data function, the camera I use has an Active X interface
with labview). The camera allows 16 bit or 12 bit digitization options.
I would like to save the image pizel values as a 16 bit BMP or TIFF
file. However, from what I understand, the flatten pixmap option in
labview does not support 16 bit images. How do I go about saving my
images? Any feedback would be ext...

**bit numbers in packed arrays of Boolean**I was pleasantly surprised to discover that given this code compiled
with GNAT 6.2.1 for an Intel processor:
subtype Bit_Index_16_Type is Integer range 0 .. 15;
type Bit_Array_16_Type is array (Bit_Index_16_Type) of Boolean;
pragma Pack (Bit_Array_16_Type);
for Bit_Array_16_Type'Size use 16;
function To_Bit_Array is new Ada.Unchecked_Conversion
(Source => Interfaces.Unsigned_16,
Target => Bit_Array_16_Type);
Word : constant Interfaces.Unsigned_16 := 2#1000_0000_0000_0000#;
Bits : constant Bit_Array_16_Type := To_Bit_Array (Word);
the index of Bit_...

**What is the max number of bits a boolean array can have?**Hello,
What is the maximum number of bit that a boolean array can have?
Regards,
Kaspar
...

**Append each bit to the binary number (Not Array Indicator)**Hi All
If i have the 8 Number control. Each Control represent each bit.
i.e. 0th control bit="1", 1th control bit="0", other bit = "0"....7th control bit ="1".
How to output the 1 binary number indicator. -->10000001
Thanks
Best Regards,Steve
I had solved it.
i use true/false case to multiply each bit interial.
i.e. For 8 th bit. If =0, output to 0, if =1 (i.e not equal to 0), output 10000000
For 7 th bit. If =0, output to 0, if =1 (i.e not equ...

**Convert signed integer to a 16-bit hex number**I know there must be an easy way to do this, but I'm new to matlab and have not been able to figure it out and have tried searching for a solution without luck.
I need to convert a signed integer to a 16-bit sign-extended (2's complement) hex number for output to a file.
For example:
3 -> 0003
-3 -> FFFD
I've tried using dec2hex(), but it does not support negative number. I've also tried playing around with a fi object but could not quite figure out how to make that work as I needed it to.
Any suggestions?
Thanks!
Jordan wrote:
> I know there mus...

**Converting Char Array with hex values into 32-bit integer**Hi
I have an 8 byte array of hex characters, e.g.
['c','5','3','1','0','6','5','9'] and I wanna convert this
to an unsigned int, so that unsigned int i = 0xc5310659. I wonder if
in C there is an very easy way to do that?
One cumbersome way to do that would be:
unsigned int arrToInt = 0;
for(i=0; i<8; i++) {
arrToInt =(arrToInt<<8) | toIntVal(charBuffer[i]);
}
int toIntVal(char c)
{
int value = 0;
switch (c)
{
case '0':
value = 0;
break;
case '1':
value = 1;
...

**Convert signed integer to a 16-bit hex number #2**I know there must be an easy way to do this, but I'm new to matlab and have not been able to figure it out and have tried searching for a solution without luck.
I need to convert a signed integer to a 16-bit sign-extended (2's complement) hex number for output to a file.
For example:
3 -> 0003
-3 -> FFFD
I've tried using dec2hex(), but it does not support negative number. I've also tried playing around with a fi object but could not quite figure out how to make that work as I needed it to.
Any suggestions?
Thanks!
Oops, sorry ignore this post, accide...

**Filling the n positions of an array with the n bits of an integer number**Hi there,
Is there an intrinsic procedure to do that? If not, could you take
a look at my subroutine below an tell me if I could make better
use of intrinsics at some point?
Thanks in advance,
Seneika
!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine get_bit_array(i, nbits, bit_array)
implicit none
integer, intent(in) :: i, nbits
integer, intent(out) :: bit_array(:,:)
character(len=10) :: fmt
character(len=n) :: bits
integer :: j, d
write(fmt,"(I10)")nbits
fmt = "(B"//trim(adjustl...

**How to write a grayscale 16 bit tiff image from a 2D image array**Hi,
I've got some 2D arrays which contain image information in grayscale and they are uint16 (so they have values from 0 - 2^16, 0 being the black).
I'm trying to save tiff images from these arrays but no luck.. I can't see how to determine the bit depth and I'm always getting a white image full of 255. I've been using imwrite().
Thanks for any help on that!
Kostas
"kostas Karakasiliotis" <kostas.karakasiliotis@epfl.ch> wrote in message <i6qua5$fcq$1@fred.mathworks.com>...
> Hi,
>
> I've got some 2D arrays which contain image...

**onvert GF(2) array 9 bits to binary or to Hexdecimal number..**Hello, every one. kindly Can one help me to convert GF(2) array 8 bits to binary or to hexadecimal number..
Thank you
On 8/29/2012 4:42 AM, sam wrote:
> Hello, every one. kindly Can one help me to convert GF(2) array 8 bits
> to binary or to hexadecimal number..
What's GF(2) array and what's the specific problem...
--
dpb <none@non.net> wrote in message <k1lci6$t6s$1@speranza.aioe.org>...
> What's GF(2) array
Academically GF(2) is nothing but a binary numbers.
http://en.wikipedia.org/wiki/GF%282%29
Now the rest of the post is clear like...

**count number of elements in an array and make it 12 bits and take 4 at a time and convert into decimal**#!\c\perl\bin
print "Enter Bus no :";
chomp($bus = <STDIN>);
# convert bus no. to binary
system("cls");
@array;
$rem = 0;
while($bus>=2)
{
$rem = $bus % 2;
$bus = int($bus/2);
push(@array,$rem);
}
push(@array,$bus);
@bus = reverse(@array);
print "The binary representation of BUS ID is : @bus \n";
#here i want to convert the binary number into 8 bits by putting '0' on
the left.
$bus1=length("@bus");
print "$bus1\n";
if ($bus1==1)
{
@bus="0000000@bus";
}
elsif($bus1==2)
{
@bus="000000@bus";
}
elsif...

**Number Array to Boolean Array ??**I am trying to read in an array of four values that are either "0" or "1" and I want to convert them to boolean true/false so that I can write true/false to a digital TTL signal from my USB-6008 DAQ. I'm using LabVIEW 8.0.
To simplify the problem, I have created the vi attached. Is there a way to make this work? It is currently only reading the first of the four values.
Michael J Fidler
Number_To_Boolean.vi:
http://forums.ni.com/attachments/ni/170/244930/1/Number_To_Boolean.vi
An easy way to convert numeric 0s and 1s to their boolean conterpart ...

**How can I extract the numbers from an array and diplay each one as a number rather than in an array**Hi
I am having a mad moment.
All I want to do is break my 1d numeric array into seperate numbers so they can be represented as single number numeric indicators. If I use the delete from array function the number is still represented in an array.
Very easy answer I am sure but little things like this drive us crazy.
Ash
Sorry! I was being very stupid - it was because I was wiring to the length on the delete from array function.
Fixed now
Ash
Don't use "delete from array", it is not u...

**How to convert an array of bits into an array of bytes?**If I have an array of 1s and 0s, how can I pack them
into an array of bytes (8 bits)?
Thanks.
Thank you Altenbach.
Can I ask you to save
this in a 6.1 version?
I don't have version 7.0.
Thank you,
Van
Thank you Altenbach.
You're a life saver.
Van
Thanks very much Altenbach.
Van
altenbach wrote:
> (The previous example (using 4.x type cast) is actually slightly
> flawed, because for some reason it only produces even sized output
> arrays (why???) so you would need to trim the resulting array as a
> function of the input array size.)
LabVIEW 4 booleans were 16 bit in...

**Find all indexes of numbers in an array that are equal to 'any' number in another array**a = [ 2 1 3 6 4 ];
I need to find the indexes of 1 and 6 in 'a'.
I tried find( a == [1 6] ) but it gave the following error:
??? Error using ==> eq
Matrix dimensions must agree.
One way is to find 1 and 6 individually but that is not optimal. I was wondering if there is a quick way to do it other than using 'for loop'.
"Shahzad " <shahraj81@yahoo.com> wrote in message
news:i8cso6$9db$1@fred.mathworks.com...
> a = [ 2 1 3 6 4 ];
>
> I need to find the indexes of 1 and 6 in 'a'.
> I tried find( a == [1 6] ) but it gave the...

**function to remove a array of numbers from a array?**Hello, sorry for the long rubbish title
Say I had an array: a = [1 2 3 4 5 6]
and another: b = [2 4 6]
I want a function that will remove all of the values of b
from a. So I want a function that returns this:
function(a, b) = [1 3 5]
Is such a function built in to matlab already or do I need
to write one? Thanks!
"stinkinrich88 " <stinkinrich88@gmail.com> wrote in message
<g98m4p$s9u$1@fred.mathworks.com>...
>
> Is such a function built in to matlab already or do I need
> to write one? Thanks!
help setdiff
Bruno
"Bruno Luong" <b.luong@fogal...

**hamming code, array of bytes to array of bits**Hi. I've just started programming, and I just have a little problem. I'm going to collect pedometer/accelerometer data from an FTP server and present it in LabVIEW. I've collected the binary file from the server, but the data is coded with Hamming, the data is 2 bytes, with 10 data bits and 5 hamming bits , I need to split the byte up to bits so the hamming decoder in LV can read it as '1' and '0'. I'm then going to present the x, y, and z axis data, this data are laying so that the sime time sets are following eacother, first the 2 byte for x-axis dat...

**Reading 32-bit complex numbers in IDL (16-bit real / 16-bit imaginary)**Hi,
I couldn't find a discussion of this specific problem on the group, so
I am posting it here in hope of a solution.
I have complex data in a binary file, with each value comprising of 4
bytes (32 bits), such that the 32-bit complex number consists of 16-
bit real and 16-bit imaginary. I could use define a complex array in
IDL and then read the data using the readu command, however the
"complex" format in IDL is a 2*32-bit definition, i.e. 32-bit real and
32-bit imaginary. How can I read the 16-bit real - 16-bit imaginary
complex number in IDL?
Thanks,
Waqas.
On 08/07/2011...

**Converting character array without delimiters to number array**Hi all,
I have a program which outputs data in the following format
(character array):
aaaa.aabbbb.bbcccc.ccdddd.ddeeee.eeffff.ff
where aaaa.aa would be a signed decimal number with a range -999.99
to 999.99
An example of the output would be:
19.08 2.02 6.09-131.97 -61.04 -20.12
Is there a way I could separate these numbers into separate columns
of a number matrix so I could plot the data?
Thanks for the help!
Cindy
Hi,
str=' 19.08 2.02 6.09-131.97 -61.04 -20.12'
M=sscanf(str,'%f')
J�r�me
Cindy wrote:
>
>
> Hi all,
>
> I have a program which outputs...