Converting a sequence of AOIs to a matrix