How to combine multiple GF arrays into 1 big GF array

1 visualización (últimos 30 días)
Nick
Nick el 1 de Dic. de 2022
Editada: Abhaya el 23 de Dic. de 2024
Hi,
I am creating a Hamming(7,4) code and am holding the contents in a 1x7 gf array. The goal is to take a message such as "hello" (in 8 bits per character) turn it to binary and add the Hamming(7,4) code to it then combine it all back as one. The Hamming code can only do 4 bits at a time so it is returning a 1x7 GF array. For "hello" I obtain 10 1x7 GF arrays. Is there a way to combine these arrays into one big one GF array? Or make it a 2d array? So have an array hold each 1x7 cell array? Is there a way to append the 1x7 to the big array? I am new to MATLAB so I am not sure of all of the processes .
Thank you

Respuestas (1)

Abhaya
Abhaya el 23 de Dic. de 2024
Editada: Abhaya el 23 de Dic. de 2024
Hi Nick,
To combine multiple GF arrays either vertically or horizontally, you can use MATLAB's built-in functions. Here's how you can do it:
  • Vertical Concatenation: To concatenate multiple GF arrays vertically, you can use MATLAB ‘vertcatfunction.
Below is a simple example of concatenating multiple GF arrays vertically:
%Two gf arrays of size 1*7
gfArray1 = gf([1 0 1 1 0 0 1]);
gfArray2 = gf([0 1 1 0 1 1 0]);
% Vertically concatenate
combinedGFArrayV = vertcat(gfArray1, gfArray2);
% Display the result
disp(combinedGFArrayV);
2x7 gf array with properties: x: [2x7 uint32] m: 1 prim_poly: 3
  • Horizontal Concatenation: To concatenate multiple GF arrays horizontally, you can use MATLAB ‘horzcatfunction.
Below is an example of concatenating multiple GF arrays horizontally:
gfArray1 = gf([1 0 1 1 0 0 1]);
gfArray2 = gf([0 1 1 0 1 1 0]);
% Horizontally concatenate
combinedGFArrayH = horzcat(gfArray1, gfArray2);
% Display the result
disp(combinedGFArrayH);
1x14 gf array with properties: x: [1 0 1 1 0 0 1 0 1 1 0 1 1 0] m: 1 prim_poly: 3
For further information aboutvertcat’ and ‘horzcat, please follow the MATLAB documentations given below.
Hope this solves your query.

Categorías

Más información sobre Error Detection and Correction en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by