From: Nhan Nguyen on
first .m file:
fid=fopen('Project1.txt');
c=fread(fid,'*char');
x=round(length(c)/5)

c1=c(1:966);

fid1=fopen('file1.txt', 'w');
fwrite(fid1,c1,'char');

fclose(fid);
fclose(fid1);

second .m file:
fid1=fopen('file1.txt');
tag1=fread(fid1, '*char');
fclose(fid1);

I want to spit a text file into any number of files and add a tag (1,2,3,4,etc.) at the end of each spitted files and then reassemble them in any order by reading the tag at the end of those file. I need to do this in two .m file (shown above). I got the spitting part, but I can not figure how to add an integer to a file full of character and to get the second file should read each tag at the end. Please help, I got two days for this.