How to publish a table and graph?

3 vues (au cours des 30 derniers jours)
Danny
Danny le 30 Oct 2014
Réponse apportée : Aniket le 11 Juin 2025
I have written code that takes a time series and produces a table of the inputs using the function array2table as well as a graph of the data simply using the plot command. I want to publish these outputs yet MATLAB keeps returning errors when I try to run the publish command. How can I transform the plot and/or graph to allow the publish command to publish the results?
(As a simple example, take
vect = [1 2 3 4];
tableVect = array2table(vect);
How can I publish tableVect?)

Réponses (1)

Aniket
Aniket le 11 Juin 2025
Hi @Danny,
I understand that you are creating some tables and plots in the workspace and want to publish them.
The publish command is used create formatted documents using the plain text MATLAB Code files (.m). This command does not accept workspace variables as arguments.
As a workaround, you may skip the semicolon on the lines you want to display in published document as in below code:
vect = [1 2 3 4];
tableVect = array2table(vect)
plot(vect);
This will display tableVect as well as the plot in published document.
If you do not want to have code in the published document, follow these steps:
  1. Go to Edit Publishing Options
  2. In Code Settings, set "Include Code" to false
This ensure only the results (workspace variables in this case) are published.
Please find more details regarding "Output Settings for Publishing" in this documentation: https://www.mathworks.com/help/matlab/matlab_prog/specifying-output-settings-for-publishing.html

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by