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
  • Last update: 5 years ago
  • Total downloads: 64
  • Operating system: Linux, Mac OS X, Win All, BSD, Solaris
  • Publisher: Doug Harriman
See full specifications

scripts default iconMCG - A Matlab Code Generation Engine (Scripts) Publisher's description

MCG is a tool for doing in-place code generation. MCG is intended to

MCG is a tool for doing in-place code generation. MCG is intended to
provide the maximum traceability of generated code back to the Matlab
code generator.

MCG processes a source file looking for sections of specially tagged
code. The tags that denote generation sections exist in comment
sections. These sections are expected to contain Matlab code. MCG
finds the code, executes it, then places text generated back into the
original source file.

Running MCG on itself will add a line of executable Matlab code in
this documentation header. Example code:

mcg.outl('% --Example generated code!--');

To run MCG:
>> m = mcg;
>> m.codegen('mcg.m');

After running the example above, the MCG source will have an additional
line inserted between the "]]]" and "[[[/MCG]]]" lines. Note that MCG
ships with both C and LaTeX source code generation examples.

The code generation section is denoted by two tags: "[[[MCG]]]" which
begins the section, and "[[[/MCG]]]" which ends the section. Each tag is
started by "[[[" and ended by "]]]". All code generated by the section
is placed between the section start and end tags.

All tags must be on lines which are commented out. MCG only supports
single line, not block, comments. MCG automatically determines the
comment characters being used and is thus language independent.

The section opening tag contains the Matlab code to run in order to
generate code. Any amount of valid Matlab code may exist on the lines
between "[[[MCG" and "]]]", but the "[[[MCG" and "]]]" must be on their
own lines. In addition, the section close tag "[[[/MCG]]]" must be on
its own line.

Generated code is sent to the source file by calling the static method:
MCG.OUTL. This method will append a carriage return, or a carriage
return + linefeed to the end of each line it has been passed. The
correct line ending is determined automatically.

Each block of code is executed in it's own namespace. Variables are not
retained between block calls. The MCG object provides a USERDATA
property which is accessible from the executing instance within the
code being executed. This property can be used to pass data between
different code generation sections.

The currently executing instance may be retrieved by the code being
executed by calling the method: MCG.INSTANCE.

MCG tag start and end characters can be customized, as can the section
start and end characters. Care should be taken that the tag and section
characters are not common to the language of the source file to reduce

Code blocks are handled in the order in which they exist in the source
file. Files are processed in the order in which they are passed.

MCG is a Matlab knock off of Cog by Ned Batchelder. See:

System Requirements:

MATLAB 7.11 (2010b)
Program Release Status: New Release
Program Install Support: Install and Uninstall

MCG - A Matlab Code Generation Engine (Scripts) Tags:

Click on a tag to find related softwares

Is MCG - A Matlab Code Generation Engine (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.