|
"ashish " <ashishtx@hotmail.com> wrote in message <ggcaq6$h65$1@fred.mathworks.com>...
> I have loaded .txt file and stored it in a variable. How do i create a table using that data? I need to label each column and give it a title.
By "table" you mean a new file? Then just use fprintf.
d = [1732 2 22
1777 12 15
1778 1 20
1564 4 23
1592 2 21
1592 4 2
2000 2 1
2008 11 3
2009 1 15];
titles = '"Title1","Title2","Title3"';
% write to file with pc type line breaks ('\r\n'):
fid = fopen('c:\mytable.csv','w');
fprintf(fid, '%s\r\n', titles);
fprintf(fid, '%f,%f,%f\r\n', d);
fclose(fid)
Such a csv file should open correctly in standard spreadsheet software, like OpenOffice. If it is MS Excel, of course, you may look at xlswrite and use a single cell array.
Regards
Andres
|