monkey_matlab - try creating a cell array of the three matrices A1, A2 and A3. (A cell array is used since these three matrices are of different dimensions.)
matrixData = cell(3,1);
matrixData{1} = A1;
matrixData{2} = A2;
matrixData{3} = A3;
for k=1:length(matrixData)
mtxRank = rank(matrixData{k});
fprintf('Rank of A%d is %d\n', k, mtxRank);
[r,c] = size(matrixData{k});
mtxNulity = c - mtxRank;
fprintf('Nullity of A%d is %d\n', k, mtxNulity);
end
In the above, we iterate over each element in the cell array and consider the rank and nullity for each.