|
|
Re: fprintf to write array to text file
Posted:
Jan 11, 2008 1:16 PM
|
|
In article <fm8b2i$hhn$1@fred.mathworks.com>, Tim <timbrown@nospamhere.nope> wrote: >zhangfujian wrote in message >> A for loop may be is useful for your problem. >> Try something like this. It works. >> >> savefile = 'temp.txt'; >> result1 = 5.3; >> result2 = 3.3; >> result3 = 1; >> mainArray = [1.2 2.3 3.4 ; 11.3 1.4 5.6 ; 1.5 2.3 10.2] >> >> >> %Sample Code: >> fprintf(myfile, '%g\t%g\t%g\n',mainArray(i,:));
>(1) So there is really no other way to add a whole array to >a text file?
cvswrite(), dlmwrite()
You can set the cell delimiter to be a tab or space.
dlmwrite offers a 'precision' option which can be the number of significant digits or a format specifier string. -- "No one has the right to destroy another person's belief by demanding empirical evidence." -- Ann Landers
|
|