From: Arsalan on
Does anyone know what the best way is to embed text from an external text file into the publishing Matlab file so it appears in HTML output. Basically, I would like to generate my HTML table codes in separate text files beforehand and embed them into the comment section so the resulting tables appear in the HTML report.
From: TideMan on
On Jul 15, 12:34 pm, "Arsalan " <afarr...(a)phn.com> wrote:
> Does anyone know what the best way is to embed text from an external text file into the publishing Matlab file so it appears in HTML output. Basically, I would like to generate my HTML table codes in separate text files beforehand and embed them into the comment section so the resulting tables appear in the HTML report.

Not sure what you're asking, but if you want to generate tables with
numbers that are populated from Matlab data, here is one way:
1. Write a .html template file with tokens in the places for numbers.
e.g. yyyymmdd may be in the place where you want a date.
2. Read the .html file into Matlab as a single string using
a=fscanf(fid,'%c');
3. Change the tokens to numbers, e.g.,
a=strrep(a,'yyyymmdd',datestr(t));
4. Write the .html data to a new file using fprintf(fid,'%c',a);
From: Arsalan on
Thanks for the reply. My objective is to use Matlab publish command to generate HTML reports. The way it works is that it uses the comment texts as report body texts (I disable the code appearance). Now I would like to insert certain text from and external text file into this comment text section. (like in Latex they use \input command to insert any file any where within the body text)
Cheers



TideMan <mulgor(a)gmail.com> wrote in message <84e8c1cd-7fb2-456d-82d9-c5997f4851ed(a)y21g2000pro.googlegroups.com>...
> On Jul 15, 12:34 pm, "Arsalan " <afarr...(a)phn.com> wrote:
> > Does anyone know what the best way is to embed text from an external text file into the publishing Matlab file so it appears in HTML output. Basically, I would like to generate my HTML table codes in separate text files beforehand and embed them into the comment section so the resulting tables appear in the HTML report.
>
> Not sure what you're asking, but if you want to generate tables with
> numbers that are populated from Matlab data, here is one way:
> 1. Write a .html template file with tokens in the places for numbers.
> e.g. yyyymmdd may be in the place where you want a date.
> 2. Read the .html file into Matlab as a single string using
> a=fscanf(fid,'%c');
> 3. Change the tokens to numbers, e.g.,
> a=strrep(a,'yyyymmdd',datestr(t));
> 4. Write the .html data to a new file using fprintf(fid,'%c',a);