%%-----------------------------------------------------------%%
%% ................. FUNCTION prtrcell  .....................%%
%%-----------------------------------------------------------%%
%% This function print a set of reaction defined in 
%% stoichiometric matrix (Y). Each row of Y is checked for
%% non-zero coefficients (if abs(sum(row(i)))==0, then 
%% this row is not printed)
%% this version of printreac uses cell input for compound id
function prtrcell(nir, nc, Y, A, wrgstoi)
epsi  = 1e-6;     %% set tolerance for zero stoi. coefficient    
for i = 1 : nir
    rowsum = max( abs(Y(i,:)) );
    %% fprintf('%i %i \n',i,rowsum);
    if( rowsum < epsi )
        continue
    end
    if( wrgstoi(i) == 0 )
        fprintf('Reaction N: %i\t     \t',i);
    else
        fprintf('Reaction N: %i\t ERR \t',i);
    end
    %% reactants
    sep = ' ';
    for j = 1 : nc
        if ( Y(i,j) < 0 )
            if ( (abs(Y(i,j))) == 1)
                fprintf(' %s %s', sep, A{j}(:));
            else
                if ( mod(Y(i,j),1) == 0)
                    fprintf(' %s %i%s', sep, -Y(i,j) , A{j}(:));
                else
                    fprintf(' %s %3.1f%s', sep, -Y(i,j) , A{j}(:));
                end %if
            end %if
            sep = '+';
        end %if
    end %for
    fprintf('  %s','=');
    sep = '';
    %% products
    for j = 1 : nc
        if ( Y(i,j) > 0 )
            if ( (abs(Y(i,j))) == 1)
                fprintf(' %s %s', sep, A{j}(:));
            else
                if ( mod(Y(i,j),1) == 0)
                    fprintf(' %s %i%s', sep, Y(i,j) , A{j}(:));
                else
                    fprintf(' %s %3.1f%s', sep, Y(i,j) , A{j}(:));
                end %if
            end %if
            sep = '+';
        end %if
    end %for
    fprintf('\n');
end %for
end % function printreac