MATLAB is pretty good with vectors and matrices, but when it comes to "general arrays" you'll often have to switch to "general methods". When you're used to the ease with which you manipulate matrices/vectors, this will seem really clumsy, backward and not very convenient at all (there's actually very defendable reasons for that, but that's a discussion for another time :).
The version below loops through each page via arrayfun
(which is only faster than a normal loop for large matrices) and calls diag
on each page:
% "flip" the array, so that 3rd dimension becomes the 1st (rows), and
% the 1st dimension becomes the 3rd, so that each "page" is a regular
% matrix. You want the diagonals of all these matrices.
b = permute(a, [3 2 1]);
% Now "loop" through the pages, and collect the matrix diagonal for each page
c = arrayfun(@(ii)diag(b(:,:,ii)), 1:size(b,3), 'UniformOutput', false);
% The above will output a cell-array, which you can cast back to
% a numeric matrix through this operation:
A = [c{:}];