Fix sampling when number of simulation iterations (B) is different than number of available matrices