function out = clrlinear(file,p)
%file must be square
%same as "imglinear" but with each color quantisized
%Some parts of code obtained from
%http://math.gmu.edu/~tsauer/class/447/proj/chap11.pdf

Q = p* [8 16 24 32 40 48 56 64     %Linear Quantiziation matrix
    16 24 32 40 48 56 64 72
    24 32 40 48 56 64 72 80
    32 40 48 56 64 72 80 88
    40 48 56 64 72 80 88 96
    48 56 64 72 80 88 96 104
    56 64 72 80 88 96 104 112
    64 72 80 88 96 104 112 120]

X = imread(file);
X = double(X);

r = X(:,:,1);
g = X(:,:,2);
b = X(:,:,3);

[m,n] = size(r);

%Quantisize for red
for i = 1:8:m
    for j = 1:8:n

        block = r(i:i+7,j:j+7);
        comp = imagecomp(block,Q);
        r(i:i+7,j:j+7) = comp;

    end
end

%Quantisize for green
for i = 1:8:m
    for j = 1:8:n

        block = g(i:i+7,j:j+7);
        comp = imagecomp(block,Q);
        g(i:i+7,j:j+7) = comp;

    end
end

%Quantisize for blue
for i = 1:8:m
    for j = 1:8:n

        block = b(i:i+7,j:j+7);
        comp = imagecomp(block,Q);
        b(i:i+7,j:j+7) = comp;

    end
end

%insert quantisized colors back into matrix
X(:,:,1) = r;
X(:,:,2) = g;
X(:,:,3) = b;

figure
imagesc(uint8(X));

title(['P = ', num2str(p)])

out = X;
Not enough input arguments.

Error in clrlinear (line 7)
Q = p* [8 16 24 32 40 48 56 64     %Linear Quantiziation matrix