1v = 64;
2filein = '~/GAPFiles/SRG/64-18-2-6.txt';
3fileout = '~/GAPFiles/SRG/64-18-2-6.dat';
4
5fidin = fopen(filein,'rt');
6hchars = fgetl(fidin);
7hchars2 = fgetl(fidin);
8
9c = textscan(fidin,'%s','Delimiter','');
10fclose(fidin);
11
12c = cell2mat(cellfun(@(s)s-'0',c{1},'Uniform',false));
13
14fidout = fopen(fileout,'w');
15fprintf(fidout,hchars);
16fprintf(fidout,'\n');
17fprintf(fidout, hchars2);
18fprintf(fidout,'\n');
19fprintf(fidout,'[\n');
20
21formatSpec = '[%d';
22
23for i = 2:v
24  formatSpec = [formatSpec,',%d'];
25end;
26
27formatSpec = [formatSpec,'],\n'];
28
29num = length(c)/v;
30
31for i = 1:num
32  fprintf(fidout,'[\n');
33  for j = 1:v
34    fprintf(fidout,formatSpec,c((i-1)*v+j,:));
35  end;
36  fprintf(fidout,']\n,\n');
37end;
38
39fprintf(fidout,'];');
40
41fclose(fidout);