There is no builtin functionality that will do that transparently, unfortunately. You'll have to build the new file
m = importdata(yourfile);
fid=fopen('new.txt','w');
for ix=1:length(m.textdata)
fprintf(fid,'%s\n',char(m(i).textdata));
end
fprintf(fid,'%d ',m.data')
fid=fclose(fid);
type new.txt
You can overwrite the original file but that's dangerous unless you've thoroughly tested your script/function first, so better to write a new file then rename the old while getting started.
Again, afaik there's no total packaged function that will reproduce the above automagically -- seems like a logical extension but to this point "it ain't happened yet".
Best Answer