Added writing matrix to unix process