x = 0:.1:1;A = [x; exp(x)];fileID = fopen('exp.txt','w');fprintf(fileID,'%6s %12s\n','x','exp(x)');fprintf(fileID,'%6.2f %12.8f\n',A);fclose(fileID); x exp(x) 0.00 1.00000000 0.10 1.10517092 0.20 1.22140276 0.30 1.34985881 0.40 1.49182470 0.50 1.64872127 0.60 1.82211880 0.70 2.01375271 0.80 2.22554093 0.90 2.45960311 1.00 2.71828183
Can I add data and output it row by row? like
x exp(x)0 1
then I could add one more row without to define the x again?
x exp(x)0 1 0.4 1.49
it is because the result inside a for loop each time only output one row.
But,I don't want store all the result into matrix ,then like what I do above.
I want each time after 1 loop it can add one row.
like writing stuff in csv file result(1,i) result(1,i+1)
Best Answer