MATLAB 7.0.4 (R14) HTML Support
Show older comments
Hi
here is the exact code:-
username = getenv('USERNAME');
FID = fopen('Report.htm','wt');
fprintf(FID,['%s\n'],'<html>','<head>','<title>','Report', ...
'<title>','<table border = "0" width="100%" ><tr><td width="10%" align = left >
<<logo.bmp>>
', ...
'<p align = "CENTER"><b><font size = "5"><font style ="text-transform:uppercase">','Report_mod', ...
'</font><font size = "3"/><p align = "RIGHT"><b> Created By:',username,'<b><p align = "RIGHT">Generated On: ',datestr(now),...
'<HR><HR color = "blue"><HR size = "3" width = "45">');
3 Comments
TAB
on 24 Oct 2011
The syntax of code you have posteted here is not correct. Please post the correct code and format it make it readable.
See Markup help on this page.
pankaj sarwe
on 24 Oct 2011
Walter Roberson
on 24 Oct 2011
Pankaj, you have not indicated what the question or concern is?
Answers (1)
Walter Roberson
on 24 Oct 2011
When I test, the only difficulty I have with the code (after I fclose(FID) ) is that on my Linux system, there is no environment variable name USERNAME so that part comes out blank. (In Linux, the corresponding environment variable is named USER )
Tabrez's point about how %% should be used to represent % is technically correct, but in this particular case fprintf() is understanding the intent anyhow.
The output I see is:
<html>
<head>
<title>
Report
<title>
<table border = "0" width="100%" ><tr><td width="10%" align = left >
<<logo.bmp>>
<p align = "CENTER"><b><font size = "5"><font style ="text-transform:uppercase">
Report_mod
</font><font size = "3"/><p align = "RIGHT"><b> Created By:
<b><p align = "RIGHT">Generated On:
24-Oct-2011 13:06:31
<HR><HR color = "blue"><HR size = "3" width = "45">
1 Comment
Walter Roberson
on 24 Oct 2011
On the other hand, the <head> should either be left out or else you should have </head> immediately afterwards. There should be a <body> section right after that. Titles and tables do not belong in a head section, they belong in <body>. The <body> should then be terminated at the bottom with </body> and there should be an </html> to end everything off.
But those are HTML issues, not MATLAB issues.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!