File Exchange

image thumbnail

Html Table Writer

version (3.43 KB) by Roger Parkyn
Writes a cell-array to an html file. Numerous formatting options are available.


Updated 01 May 2013

View Version History

View License

Writes a cell-array to an html file for display via html browsers. Numerous formatting options are available to customise the look.
Optionally, as well as the output html file, it is also possible to output the result as a string variable in Matlab. Formatting options include font and background colours, including over-rides for specified rows.

Cite As

Roger Parkyn (2021). Html Table Writer (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (13)

Roger Parkyn

Lavi, In short: no. It might (?) be possible to convert your numbers to a cell-array of strings, in that format, and then write that.

Lavi Sekundo

Great function!!!
Is there a way to format the numeric values to comma separated at the thousands e.g. from 100000 to 100,000

Roger Parkyn

Hi Lukasz, You can see the options that are currently coded in the section where p.addParamValue gets specified (at the start of the code). I'm not exactly sure what formatting you require but it may be possible for you to add it to those specs and then adapt the code to utilise that parameter value.

Lukasz Piasta

how can i add more conditions related with font color? NegativeCellFontColour2 and NegativeCellFontColour3 ... does not work


could we use it directly insideof:
fprintf(fid,['\t\t<table style=" color:',p.Results.FontColor,'; ',...
'font-size:', num2str(p.Results.FontSize),'; ',...
'font-family:', p.Results.FontFace,'; ',...
'text-align:', p.Results.TextAlign,'; " ',...
'cellpadding="',num2str(p.Results.CellPadding),'" ',...
'cellspacing="',num2str(p.Results.CellSpacing),'" ',...
'border="',num2str(p.Results.BorderSize),'" ',...
'bordercolor="',p.Results.BorderColor,'" ',...
' ><col width="130">\n']);
fprintf(fid,['\t\t\t<caption>',p.Results.Caption,'</caption>\n']); %add the caption

Roger Parkyn

Dalis: It is relying on the default column widths. It would be possible to get it to add lines to specify widths, like:
<col width="130">
but that hasn't been coded in this function sorry.


Very usefull topic , but how to set desired constant width for each column is there any sollution for this ? Thank you !


Roger Parkyn

Joshua: Nice to hear, thanks. I don't know anything about Latex in html but except to say that if you can express it in text that html will understand then it "should" display as table contents.


Thanks for the great function! Any advice on how to put Latex markup (like theta hat) as column headings?


Roger Parkyn

Ulf: thanks for the comment and rating! The file has been up for a few years and has been really useful for me at least so it is nice to see someone comment at last.


greatly tool, that was what I'm looking for. Now I can easily print the content of my cell variables into an html-file. Thank you for this great job.

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: HTMLtable

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!