Let the matrix be [adgbehcfi]
Since the elements can be either of 0or1, so
a+b+c+d+e+f+g+h+i=2/3/5/7
For sum as 2, the number of cases will be 2!7!9!=36
For sum as 3, the number of cases will be 3!6!9!=84
For sum as 5, the number of cases will be 5!4!9!=126
For sum as 7, the number of cases will be 2!7!9!=36
Total required matrix will be 282