I think Scilab is not really suited for the preparation of a report or
an article. But with the export possibilities (e.g. eps or xfig format)
and your standard tool for writing reports (latex would be preferable,
but word, open office, powerpoint or anything like that will also work)
it should not be a problem to create any kind of report needed.
It is also possible to do a automatisation if have to do the same kind
of report regularly. Scilab can produce the latex file, compile it and
create a pdf or ps file from the dvi file with just one mouse click (of
course after some programming...). If you're interested, I can send you
some examples.
Kind regards
Andreas Benkert
Hallo NG,
is there a append-mode for grafiks, similar in matlabs print command?
Frank
Andreas Benkert ha scritto:
Another solution is to have Scilab write a Docbook XML or SGML file
(http://www.docbook.org/whatis). From this, calling whether an XML
processor like xsltproc or a DSSSL engine like Openjade, you can
produce various output from the same source. The output formats are
HTML, RTF, TeX, LaTeX, PDF. The conversion to OpenOffice's ODF is an
ongoing project (search for docbook2odf with google). A major
difference between the LaTeX and the Docbook solution is that the
latter technology completely separates semantics and style.
I have used Docbook in connection with Scilab several times for writing
simulation or measurement reports and feel quite happy with it. I can
show you a few examples if you are interested, and share some lines of
code too.
Best regards,
G. Dutilleux
Guillaume Dutilleux ha scritto:
Guillaume Dutilleux ha scritto:
For producing a ps file the LaTeX way seems the most straightforward
solution. Here is an example. A standard LaTeX installation should do
the job whatever the platform. Mine is Mac OS X here. I run Scilab
3.1.1.
function s=latex_figure(figtitle,fname)
s='\begin{figure}{'+figtitle+'}';
s=[s;'\begin{center}'];
s=[s;'\epsfig{width=7cm,file='+fname+'}'];
s=[s;'\end{center}'];
s=[s;'\end{figure}'];
endfunction
texfname='sample.tex'
txt='This is a comment';
txt2='Another comment';
xset('window',0);
xbasc();
plot(rand(1,1000));
figname1='fig1.eps'
xs2eps(0,figname1);
xbasc();
plot(1:1000);
figname2='fig2.eps';
xs2eps(0,figname2);
tex_header=['\documentclass[a4]{article}';..
'\usepackage{epsfig}';..
'\pagestyle{empty}';..
'\begin{document}'];
tex_body=[txt;' ';' ';..
latex_figure('random data',figname1)
txt2;..
latex_figure('arithmetic series',figname2)];
tex_end='\end{document}';
s=[tex_header;tex_body;tex_end];
mputl(s,texfname);
[foo,name,ext]=fileparts(texfname);
host('latex '+name);
host('dvips -o '+name+'.ps '+name+'.dvi');
The Docbook way would be quite similar. The Docbook syntax is verbose
but I feel it is more systematic and easier to handle programmatically.
For Windows users, setting up a Docbook toolchain is not as hard as it
used to be. See wikipedia for a link to a self-contained Docbook
environment.
Best regards,
Guillaume Dutilleux
function s=tag(tagname,content)
topen='<'+tagname+'>';tclose='</'+tagname+'>';
if size(content,'*')==1 then
s=strcat([topen,content,tclose],'');
else
s=[topen;content;tclose];
end
endfunction
function s=db_figure(figtitle,fname,width)
s=tag('title',figtitle);
si=tag('imageobject','<imagedata width='"'+width+''"
fileref='"'+fname+''" format='"GIF'"/>');
si=[si;tag('textobject',tag('phrase','image description'))];
s=[s;tag('mediaobject',si)];
s=tag('figure',s);
endfunction
dbfname='sample.xml'
txt='This is a comment';
txt2='Another comment';
xset('window',0);
xbasc();
plot(rand(1,1000));
figname1='fig1.gif'
xs2gif(0,figname1);
xbasc();
plot(1:1000);
figname2='fig2.gif';
xs2gif(0,figname2);
db_version='4.2.0';
db_header=['<?xml version='"1.0'" encoding='"iso8859-1'" ?>';..
'<!DOCTYPE article PUBLIC '"-//OASIS//DTD DocBook XML
V'+db_version+'//EN'"..
'"/sw/share/xml/dtd/docbookx/'+db_version+'/docbookx.dtd'">'..
];
db_title=[tag('title','Sample docbook document');..
tag('author',tag('firstname','John')+tag('surname','Doe'))];
db_title=tag('articleinfo',db_title);
db_body=[tag('title','Chapter title');
tag('para',txt);..
db_figure('random data',figname1,'8cm');..
tag('para',txt2);..
db_figure('arithmetic series',figname2,'8cm')];
db_body=tag('section',db_body);
s=[db_header;tag('article',[db_title;db_body])];
mputl(s,dbfname);
[foo,name,ext]=fileparts(dbfname);
db_stylesheet='/sw/share/xml/xsl/docbook-xsl/fo/docbook.xsl';
host('xsltproc -o '+name+'.fo '+db_stylesheet+' '+dbfname);
host('fop '+name+'.fo '+name+'.pdf');
host('fop '+name+'.fo -ps '+name+'.ps');
db_stylesheet='/sw/share/xml/xsl/docbook-xsl/html/docbook.xsl';
host('xsltproc -o '+name+'.html '+db_stylesheet+' '+dbfname);
Hope this helps,
G. Dutilleux