MATLAB 7.0.4 (R14) HTML Support
显示 更早的评论
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 个评论
TAB
2011-10-24
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
2011-10-24
Walter Roberson
2011-10-24
Pankaj, you have not indicated what the question or concern is?
回答(1 个)
Walter Roberson
2011-10-24
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 个评论
Walter Roberson
2011-10-24
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!