Matlab publish command use cases

3 views (last 30 days)
Robert Cumming
Robert Cumming on 28 Nov 2012
I use Matlab every (working) day and have found little practical use for the publish command - it looks good in demos but in a real world environment we have not found it to be beneficial to our work.
You could summarise our work into 3 methods: 1. Interactive gui's. 2. Automated batch jobs which curn through calculations and generate output files of results - no plotting 3, Automated batch jobs (as above) but also produce pdf plots (through print to .ps then convert to .pdf).
I just dont see where publish would bring benefits - any comments?
Have you used the publish command?
If so how do you use it?
I'm not sure how I will "accept" any specific answer here - I am just looking for other, experienced users, use cases.
Robert Cumming
Robert Cumming on 30 Nov 2012
I concur that the link Sara and Sean provided is an excellent example of how it can be used for a users script - a truly excellent use of images and Latex.
But, in my view - it isn't an "industrial" use case in the general sense of how most(?) people work.
i.e. calculations and processing is done by functions not scripts...

Sign in to comment.

Answers (2)

Sean de Wolski
Sean de Wolski on 28 Nov 2012
Edited: Sean de Wolski on 28 Nov 2012
Here are my use-cases:
  • In college it was nice for students to do homework with it. You could see the code and the results it produces. By looking at the results it meant you didn't have to run every file but could glance and see results. This came with code and formatting that you wouldn't get with diary.
  • As a Civil Engineer in college it was nice to be able to publish code to create reports of things that would typically be done in MathCad or by hand: e.g. (embarassingly) trivial example:
%%Calculate Pressure
A = 15; %ft^2
f = 70; %lbf
P = f./A; %pressure lbf/ft^2
At MathWorks:
  • Developed a test suite that did something. Well actually it did a whole lot of somethings with each something producing a figure filled with something. Then to run all of the tests I just had to run a driver *.m file. Publishing this would give me a report of all of the tests in a nice simple HTML file (with all of the figures stored as individual *.PNGs for free!).
And I would say that this is a completely ideal use of it:
  1 Comment
Robert Cumming
Robert Cumming on 30 Nov 2012
Sean - in your testing do you link it in with the xUNIX FEX?

Sign in to comment.

owr on 28 Nov 2012
I use it every afternoon to update research reports based on new data that are referenced by my colleagues. I publish to html and copy the generated files to an internal web server where they can be viewed in a browser. I chose html because the reports include dynamic sized tables that are often too wide to fit within a word, pdf, etc. document. Horizontal scrolling in html alleviates this issue. I also include images, which is probably the biggest reason I use publish - the automatic embedding is quite useful and I dont have to mess around with active x to figure out how to write these images and tables to specific ranges within an Excel document.
With that said, I had to write a significant amount of my own tools to create html tables from array data in MATLAB to get proper formatting in the web browser. I also ran into several issues with excessive css declarations that publish includes in newer versions of MATLAB (2012a).
In the long run, I will probably extend my tool set to automatically export figures to image files and embed them in the html documents. At that point I will be able to create the html files myself as text files and will no longer need publish. This will also allow me to compile this process and run it on a computer other than my dedicated MATLAB machine.
So publish has been useful in allowing me to create these daily reports by handling some of the formatting details so I dont need to deal with all of them myself. However, out of the box, I agree that publish does not currently contain enough formatting features to create anything other than "toy" reports. But Im grateful that it is available as it gave me a decent start.
owr on 28 Nov 2012
Sean, thanks for the suggestion. I am familiar with Report Generator, but unfortunately it doesnt meet my needs (as of 2 years ago at least). As I understand it, it can be quite useful for Simulink, but Ive been underwhelmed with its capabilities within a pure MATLAB setting and actually prefer cell mode publishing. My needs are pretty specialized though.

Sign in to comment.



Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by