12-27-2013 06:39 AM - 편집 12-27-2013 06:39 AM
I have array with bits in each row and in one column. Now I ned to delete LSB (parity bit) and then assemble all 7 bits back together and split them in parts by 8 bits.
My idea was to put bits in matrix and then take from matrix first 7 columns. Problem is that I don't know hot put each bit in his own column. Next problem is how to convert this in bytes.
Can you give an example of what you want. Posting a VI with default data is the best way.
What does your initial data look like (what data types)? What is the end result you want? Are you supposed to just use 7 bits in your byte or are you supposed to shift bits in from other bytes?
12-27-2013 07:41 AM - 편집 12-27-2013 07:43 AM
I will tray explain. I get 144 bytes from server. Those 144 bytes are separated in frames by 8 bits (7 data +1 parity). On the end I need to read message that is sent from server in ASCII code. Now I need delete parity bit so I can read message.
I have numbers in array like this
What I want is this
I must delete last column and put rest 7 bits together. This suposed to be my message. First 7 bytes is header.
I can post server and client. Server is in matlab. Main file of server in matlab is oddajnik.m. Server we got from professor.
I can't attach server.rar so I uploaded it on sendspace
날짜:
12-27-2013
09:32 AM
- 마지막 편집 날짜:
08-13-2024
03:53 PM
, 작성자:
Content Cleaner
The simplest way would be to just use the Logical Shift function. It can accept your array of bytes and perform a shift on each byte. Set N to be -1 to perform a shift to the right (LSB is removed).
Now I need to put all bits together and make parts of 8 bits. I forget to write this in last post. Like you sad before I need shift bits in from other bytes.
If I have now
1011011
1000110
1001111
then I should have
101101110001101001111 and from this parts of 8 bits
10110111
00011010
01111... and so on
Now I have 144 bytes. On the end I should have about 120 bytes.
Hi arozma,
Please check the screenshot i have added and if it helps to solve your problem.
날짜:
12-27-2013
10:57 AM
- 마지막 편집 날짜:
08-13-2024
03:54 PM
, 작성자:
Content Cleaner
While it would not be too diffiicult to combine the bits with numeric, it would need some extra code (e.g. similar to the old bit twiddling challenge) ;).
Unless performance is critical, It might be easier to convert to a boolean array, concatenate the subsets, and then convert back to a shorter U8 array.
As a first step you need to tell us how your "bits" are represented in your code. Whatever you showed us made no sense:

You get a string. What is the format of the string? Is this a binary string (each byte representing 8 bits) or a string containing characters 0 and 1? You convert it to a U8 array, then into a 2D U8 array with one row, then back to the 1D array you originally had. This makes absolutely no sense.
12-27-2013 11:07 AM - 편집 12-27-2013 11:08 AM
This isn't exactly a simple task. You can do with with boolean arrays. I'm not happy with it, but it works.

I'm sure we can get this to work without changing data types, but I don't have the time to play with it right now.
This should convert the string to an array of U8, remove the parity bit, shift the remaining bits to the right, and change it back to a string.
Lynn
날짜:
12-28-2013
03:56 AM
- 마지막 편집 날짜:
08-13-2024
03:54 PM
, 작성자:
Content Cleaner
@altenbach wrote:
While it would not be too diffiicult to combine the bits with numeric, it would need some extra code (e.g. similar to the old bit twiddling challenge) ;).
Unless performance is critical, It might be easier to convert to a boolean array, concatenate the subsets, and then convert back to a shorter U8 array.
As a first step you need to tell us how your "bits" are represented in your code. Whatever you showed us made no sense:
You get a string. What is the format of the string? Is this a binary string (each byte representing 8 bits) or a string containing characters 0 and 1? You convert it to a U8 array, then into a 2D U8 array with one row, then back to the 1D array you originally had. This makes absolutely no sense.
It suposed to be a binary string.
Yes, you have right. I tried many things before I get all data in one array. When I finaly made what I want, I leaved the code like it was. I fixed it now.
I learned basics of Labview a few years back. Since then I didn't worked with Labview. I tod I don't need to look basics again. Apparently I was wrong.
Thank you all for your time and help. Now its on me to implement your code.