% and function and or function
function [out] = logic_abcx(func)

last = size(func,2);
nnew = 0;
for nc = 1:last
    if strcmp(func(nc),'a')|strcmp(func(nc),'b')|strcmp(func(nc),'c')
        nnew = nnew + 1;
        func1(nnew:nnew+4) = [func(nc) '(i' func(nc) ')']; 
        nnew = nnew + 4;
    end
    if strcmp(func(nc),'&')|strcmp(func(nc),'|')|strcmp(func(nc),'~')...
            |strcmp(func(nc),'(')|strcmp(func(nc),')')
        nnew = nnew + 1;
        func1(nnew) = func(nc);
    end
end

a = logical([0 1]);
b = logical([0 1]);
c = logical([0 1]);

ln = 0;
for ia = 1:2
    for ib = 1:2
        for ic = 1:2
            ln = ln + 1;
            eval(['fx(ln) = ' func1 ';'])
            a_in(ln) = a(ia);
            b_in(ln) = b(ib);
            c_in(ln) = c(ic);
        end
    end
end

% - rearrange into columns
a_in = a_in';
b_in = b_in';
c_in = c_in';
fx = fx';

% - display input and output
out = [a_in b_in c_in fx];

