MATLAB: How can I get the results in a csv file rather than a figure

heat equationMATLAB

Here is my code:
L=1;
t=1;
k=.001;
n=11;
nt=500;
dx=L/n;
dt=.002;
alpha=k*dt/dx^2;
T0=400*ones(1,n);
T1=300*ones(1,n);
T0(1) = 300;
T0(end) = 300;
for j=1:nt
for i=2:n-1
T1(i)=T0(i)+alpha*(T0(i+1)-2*T0(i)+T0(i-1));
end
T0=T1;
end
*export(dataset,'file','Trial.csv','Delimiter',',');*
plot(T1)
I do not want the plot but i want the calculated data exported to a csv file. Can anyone point to my mistake?

Best Answer

EDITED
dlmwrite('Trial.csv',T1,'Delimiter','\n') %exports T1 values as csv file
Likewise you can export all the values in the same csv file
Related Question