# Generating reports with matlab

 Page 1 / 1
Basic Publishing with MATLAB

MATLAB includes an automatic report generator called publisher. The publisher publishes a script in several formats, including HTML, XML, MS Word and PowerPoint. The published file can contain the following:

• Commentary on the code,
• MATLAB code,
• Results of the executed code, including the Command Window output and figures created by the code.

## The `publish` Function

The most basic syntax is `publish('file','format')` where the m-file is called and executed line by line then saved to a file in specified format. All published files are placed in the html directory although the published output might be a doc file.

## Publishing with editor

The publisher is easily accessible from the Tool Strip:

Write a simple script and publish it in an html file.

Select File>New>Script to create an m-file. Once the editor is opened, type in the following code:

```x = [0:6]; % Create a row vectory = 1.6*x; % Compute y as a function of x [x',y']% Transpose vectors x and y plot(x,y),title('Graph of y=f(x)'),xlabel('x'),ylabel('f(x)'),grid % Plot a graph```

Save the script as publishing.m and select Publish>Publish.

An HTML file is generated as shown in the figure below:

## The double percentage `%%` Sign

The scripts sometimes can be very long and their readability might be reduced. To improve the publishing result, sections are introduced by adding descriptive lines to the script preceded by `%%` . Consider the following example.

Edit the script created in the example above to look like the code below:

```%% This file creates vectors, displays results and plots an x-y graph x = [0:6]; % Create a row vector y = 1.6*x; % Compute y as a function of x%% Tabulated data [x',y']% Transpose vectors x and y %% Graph of y=f(x)plot(x,y),title('Graph of y=f(x)'),xlabel('x'),ylabel('f(x)'),grid % Plot a graph```

Save the script, a new HTML file is generated as shown in the figure below:

## Summary of key points

1. MATLAB can generate reports containing commentary on the code, MATLAB code and the results of the executed code,
2. The publisher generates a script in several formats, including HTML, XML, MS Word and PowerPoint.
3. The Double Percentage `%%` can be used to creates hyper-linked sections.

#### Questions & Answers

who was the first nanotechnologist
Lizzy Reply
k
Veysel
technologist's thinker father is Richard Feynman but the literature first user scientist Nario Tagunichi.
Veysel
Norio Taniguchi
puvananathan
Interesting
Andr
I need help
Richard
anyone have book of Abdel Salam Hamdy Makhlouf book in pdf Fundamentals of Nanoparticles: Classifications, Synthesis
Naeem Reply
what happen with The nano material on The deep space.?
pedro Reply
It could change the whole space science.
puvananathan
the characteristics of nano materials can be studied by solving which equation?
sibaram Reply
plz answer fast
sibaram
synthesis of nano materials by chemical reaction taking place in aqueous solvents under high temperature and pressure is call?
sibaram
hydrothermal synthesis
ISHFAQ
how can chip be made from sand
Eke Reply
is this allso about nanoscale material
Almas
are nano particles real
Missy Reply
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
Lale Reply
no can't
Lohitha
where is the latest information on a no technology how can I find it
William
currently
William
where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
Google
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
STM - Scanning Tunneling Microscope.
puvananathan
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

### Read also:

#### Get Jobilize Job Search Mobile App in your pocket Now!

Source:  OpenStax, A brief introduction to engineering computation with matlab. OpenStax CNX. Nov 17, 2015 Download for free at http://legacy.cnx.org/content/col11371/1.11
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'A brief introduction to engineering computation with matlab' conversation and receive update notifications?

 By Jonathan Long By OpenStax By OpenStax By Darlene Paliswat By Mike Wolf By Richley Crapo By Anh Dao By OpenStax By Jesenia Wofford By Ali Sid