clear;clc; A = magic(4); fid = fopen('test.txt','wt'); for i = 1:size(A,1) for j = 1:size(A,2) fprintf(fid,'%d ',A(i,j)); end fprintf(fid,' '); end clear; A = importdata('test.txt');