|
fid = fopen('temp.txt', 'wt');
fprintf(fid, '%s\t%s\r\n', 'property1', 'property2');
for i = 1:3
fprintf( fid, '%s\t%s\r\n', ['value1_' , num2str(i)], ['value2_' , num2str(i)] );
end
fclose(fid);
The file temp.txt would then look like:
property1 property2
value1_1 value2_1
value1_2 value2_2
value1_3 value2_3
Now I want to add a column with property name 'prop3' and with whatever value 'value3' to temp.txt. How can I append that column? Note I don't want to rewrite the existing two columns. I want to append one column so that the temp.txt would look like
property1 property2 property3
value1_1 value2_1 value3_1
value1_2 value2_2 value3_2
value1_3 value2_3 value3_3
The reason I don't want to rewrite the existing two columns is that the actually temp.txt file I am dealing with is very large, and it takes a lot of time to rewrite the existing columns. thanks.
|