MATLAB: How to write cell values to a file from matlab

cell arraydlmwritefopenfor loopfprintfxlswrite

hibelow here is to create header by feteching two files input.i got my output in 'out' variable.but i couldnt able to write in excel file with delimited.
ex:
#header_01= power,load,density,temp
#header_02=mean,std,max,min
needes output: power_mean power_std power_max and so on
each cell values must be saved in each cells in excel file..im stuck..help plz
nm = {'F:\header_01.txt','F:\header_02.txt'};
c1 = cell(1,2);
for jj = 1:2
f = fopen(nm{jj});
c = textscan(f,'%s');
fclose(f);
a1 = regexp(c{:},'\w*','match');
c1{jj} = cat(1,a1{:});
end
n = cellfun('length',c1);
[ii,jj] = ndgrid(1:n(2),1:n(1));
out = reshape(strcat(c1{1}(jj),{'_'},c1{2}(ii)),1,[]);if true

Best Answer

use function xlswrite:
xlswrite('NameYourXlsFile.xlsx',out,1,'A1')
ADD
f = fopen('F:\header_01.txt');
c = textscan(f,'%s');
fclose(f);
a1 = regexp(c{:},'\w*','match');
a1 = cat(1,a1{:});
a2 = {'mean' 'std' 'max' 'min'};
[ii,jj] = ndgrid(1:4,1:numel(a1));
out = reshape(strcat(a1(jj),{'_'},a2(ii)),1,[]);
xlswrite('NameYourXlsFile.xlsx',out,1,'A1')