adding input and outout for matrix but not work