Basic Information About Galois Arrays

You can determine the length of a Galois vector or the size of any Galois array using the length and size functions. The functionality for Galois arrays is analogous to that of the MATLAB operations on ordinary arrays, except that the output arguments from size and length are always integers, not Galois arrays. The code below illustrates the use of these functions.

m = 4; e = gf([0:5],m); f = reshape(e,2,3);
lne = length(e); % Vector length of e
szf = size(f); % Size of f, returned as a two-element row
[nr,nc] = size(f); % Size of f, returned as two scalars
nc2 = size(f,2); % Another way to compute number of columns

Positions of Nonzero Elements

Another type of information you might want to determine from a Galois array is the positions of nonzero elements. For an ordinary MATLAB array, you might use the find function. However, for a Galois array you should use find in conjunction with the ~= operator, as illustrated.

x = [0 1 2 1 0 2]; m = 2; g = gf(x,m);
nzx = find(x); % Find nonzero values in the ordinary array x.
nzg = find(g~=0); % Find nonzero values in the Galois array g.


© 1994-2005 The MathWorks, Inc.