I would like to write output of Matlab code's result into a .txt file.
My code is :
for i=1:1000;
M{i}=rand(1,4)';
end
So I try :
fid=fopen('M.txt','wt');
fprintf(fid,'%.8f\n',M{i});
fclose(fid)
The result is 1*1000 cell and every cell has 4*1 matrice. But the output file has 1*4000 matrices with this. How can I write column by column to a .txt file.
Thanks in advance.
I want to write down all values of matrix like below side by side for 1000 matrices.
0.9572 0.9572 0.9572 0.9572 0.9572 0.9572 0.9572 0.9572 0.9572 0.9572
0.4854 0.4854 0.4854 0.4854 0.4854 0.4854 0.4854 0.4854 0.4854 0.4854
0.8003 0.8003 0.8003 0.8003 0.8003 0.8003 0.8003 0.8003 0.8003 0.8003
0.1419 0.1419 0.1419 0.1419 0.1419 0.1419 0.1419 0.1419 0.1419 0.1419