exporting to pdf from live script does not include control elements

hello everyone,
i wanted to make use of the live script and the export function, to export the plots i made as well as the used values into a pdf. so far that is working, but sadly control elements like the slider for example arent shown then.
wordfile = export("LiveScript_FF_Sim_20230421_structs.mlx",...
compose(dir + string(printtime) + 'FF_SIM.pdf'), ...
HideCode=true,PageSize="A4",OpenExportedFile=true);
i cant get my head around what i did wrong there. i do hide the code, cause its already some pages long without it.
something else i noticed, even tho i have "hidecode = true", i have to hide the code everytime in the live editor, let it run and scroll thru the plots, if i had it with code displayed, otherwise the plots are so tiny, as they are in the live editor, when there is just a bit of space left. i thought thats why i used hidecode in the first place.
is there a possibility to display the controle elements as well, with the variable names and assigned values ?
sincerely
André

 Accepted Answer

Controls are part of the code, so when you export with "HideCode=true", they are not included. When you do include the code, the export process converts a control to a variable set to the current value. Thre is currently no way to have it display a control element instead.
As for visualizing the plot, you could try the 'Output Inline' option to see the full sized image. It is only when you use 'Output on Right' that the size of the figures is adjusted to match the wideth of the output pane.
When you use the options in the live editor to set the output location/hide code, the editor will remember this setting. See here: https://www.mathworks.com/help/matlab/matlab_prog/add-interactive-controls-to-a-live-script.html#mw_7639166f-8831-4f10-b030-a40a63cbed77

6 Comments

I think I see a little more why you are confused.
I would recommend making a suggestion to MathWorks about this. You can do that here
i now did a lot of exporting and my conclusion ist, exporting live scripts is fundamentally broken.
  • text is not displayed in as it is in the script, sometimes all on top, or all at the bottom
  • when running in a loop previous iterations are also being exported, even if you close plots and clear all the stuff
  • that is, if something is being exported in the first place, so often i get .. "stairs", cant explain it better, instead of plots, or i get barely anything at all
  • speaking about plots, sometimes they are normal sized, sometime they are very small. it depends if you hide the code or not, and it does not matter if you have "hidecode =true" or not.
  • sometimes you have to let the script run 2 or 3 times in order for the plots to finally work again
  • when you use the export button in the editor near the save button, it does not only have the same flaws (cause its the same xD), it creates a bug where you can see the code in the live editor with hide code enabled.
  • also, when you kinda manually run the script (which i made as a loop) and change the values, let the script run, expect new output. no. the output is still the same to the previous run. even the output in the live editor shows all the shanged values and plots, the export doesnt show the new stuff. again let it run a few times and you get the new stuff
I think part of these observations are because the script is run as part of the process of exporting to pdf. It seems you are expecting the pdf to be more of a snapshot of what you see once the script has finished executing. However, it might be more accurate to think of the export of capturing all the outputs that occur when you run the script. It's trying to recreate that in pdf format. At least that's how I think of it.
This isn't to say what you are seeing is how it should be. If you are seeing bugs or even unexpected behavior, please continue reporting this using the same link as above.
a lot of the points i mentioned also happen when i didnt run it as a function, there are just a few problems on top of that. ok, then i will make another report.
is the support answering at some point, or just me making the report and then nothing else ? cause im looking always if there was an answer or follow up questions or what ever.
You should receive a response. I believe the target is 1 business day, but the confirmation email you received back should say.

Sign in to comment.

More Answers (0)

Categories

Find more on Scripts in Help Center and File Exchange

Products

Release

R2023a

Tags

Community Treasure Hunt

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

Start Hunting!