1 function a=read_array_nd(name)
2 % a=read_arrray_nd(filename)
3 % read nd matrix written by write_array_nd
4 filename = [name,'.txt'];
5 fprintf(['reading matrix from file ',filename])
8 error('not written by write_array_nd')
10 n=d(2); % number of dimensions
11 bs=3; % beginning of size
12 es=bs+n-1; % index to to end of size
13 s=d(bs:es); % array size
14 fprintf(' size %g %g %g %g %g %g %g',s)
16 if length(d)~=prod(s) + es
17 error('wrong number of terms in the file')
21 a=reshape(d(es+1:end),s');