a(g)=max(p(i,g));
The above gives maximum in array p(i,g). If p(i,g) is a scalar, the same value you will get.
a(g)=max(p(:,g));
In the above ,: stands for all, as it is present in the rwo, p(:,g) picks the entire gth column in p. And max gives you maximum in the gth column of p.
