echo on
clear all
fclose('all');

fid = fopen('square_mat.bin','wb')
fwrite(fid, 'This is a square matrix', 'char');
fwrite(fid, [1 2 3; 4 5 6; 7 8 9]', 'int32');
fclose(fid);


fid = fopen('square_mat.bin','rb')
bintitle = fread(fid, 23, 'char');
title = char(bintitle')
data = fread(fid, [3 inf], 'int32');
data_transpose = data'
fclose(fid)

echo off