About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
See full specifications

scripts default iconEMat: Embedded Matlab Templating (Scripts) Publisher's description

EMat class provides a templating system in Matlab like Ruby's ERB

EMAT Embedded Matlab templating

EMat class provides a templating system in Matlab like Ruby's ERB
system. Matlab code can be embedded inside any text document to
easily control the document generation flow.

A simple example is illustrated here:
>> x = 42;
>> tmpl = ' The value of x is <%= x %>';
>> obj = EMat(tmpl);
>> disp(obj.render);
The value of x is 42


obj = EMat
obj = EMat( S )
obj = EMat( file_path )

obj.set( S )
obj.set( file_path )

S = obj.render()
obj.render( file_path )

obj = EMat creates an empty EMat object. EMat object accepts
template string either by string variable S or by specifying a
path to the template text file_path. To set a template to the
object, use obj.set(S) or obj.set(file_path). EMat(S) and
EMat(file_path) are the shorthand for obj=EMat; obj.set(...);

S = obj.render() returns a string of the rendered document.
obj.render(file_path) instead renders output to a file specified
by the file_path.


tmpl_path: template file path. Use set() method to change
tmpl: template string. Use set() method to change
errchk: logical flag to enable/disable syntax check
(default: true)
trim: logical flag to enable/disable whitespace trim when
suppresseing newline at the end (default: true)

Template format:

Any text document can embed matlab code with the following syntax.

<% stmt %> matlab statement
<% stmt -%> matlab statement with newline suppression at the end
<%= expr %> matlab expression with rendering
<%# comt %> comment line
<%# comt -%> comment line with newline suppression at the end
<%% %%> escape to render '<%' or '%>', respectively

<%= expr %> renders output of the matlab expression to the output.
Note that numeric variables will be converted to string by
NUM2STR(). When -%> is specified at the end of the line in
statement or comment, a following newline will be omitted from the
rendering. Any other texts appearing outside of these special
brackets are rendered as is. When trim property is set true,
leading whitespace in the template is also removed from the output
with newline suppression syntax.


<!-- template.html.emat -->
<head><title><%= t %></title></head>
<%# this is a comment line -%>
<p><%= a %></p>
<% for i = 1:3 -%>
<li><%= i %></li>
<% end -%>

% In your matlab code
% Prepare variables used in the template
t = 'My template document';
a = 10;

% Create an EMat object
obj = EMat('/path/to/template.html.emat');

% Render to a file

System Requirements:

MATLAB 7.12 (2011a)
Program Release Status: New Release
Program Install Support: Install and Uninstall

EMat: Embedded Matlab Templating (Scripts) Tags:

Click on a tag to find related softwares

Is EMat: Embedded Matlab Templating (Scripts) your software?

Manage your software

Most Popular

scripts default icon ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation 1.1
ASK, OOK, FSK, BPSK, QPSK, 8PSK modulation contain several functions for digital modulation simulation
scripts default icon Simulink Communication Labs 1.1
Simulink Communication Labs allows you to learn communication systems in greater depth.
scripts default icon M-QAM modulation and demodulation 1.1
M-QAM modulation and demodulation is the QAM modulation and demodulation tech.
scripts default icon LZW Compression/Decompression 1.1
LZW Compression/Decompression - Updated LZW compressor and decompressor with reasonable performance
scripts default icon InSPIRE utility to plot a 2D displacement field (Scripts) 1.0
This program plots the deformation field (displace vectors) contained in vector.txt.