- Go to Edit Publishing Options
- In Code Settings, set "Include Code" to false
How to publish a table and graph?
5 views (last 30 days)
Show older comments
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?)
0 Comments
Answers (1)
Aniket
on 11 Jun 2025
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:
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
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!