how to create an automatically and nice "report" without report Generator

23 views (last 30 days)
Good morning everybody
i looking for an solution to report my result. I made an interface in the appdesigner to enter so measurements results and by pushing the start button a nice report (with a nice heading of the athlets data, the measurement results and some picutres but no code) should be publish automatically. I createt the report in the live-script (part of the live scripts is below) and by pushing the button the live-script should be filled in the the data. I tried two alternatives:
1) the first one is with PUBLISH. I used the follow code but i always got the same Error:
THIS is in my app designer programm
%% save the publishing data as a struct h
h.name = m.name;
h.bd = m.bd;
h.sports = m.sports;
h.d = d;
%% Live-Script Aufrufen
publish('Handout.mlx','showCode',false,'format','pdf','codeToEvaluate','daten_auslesen(h)');
and i always got the following error:
Error using evalin
Unrecognized function or variable 'h'.
I have the function daten_auslesen saved extern as a .m file (see below) now. Bevor i had it saved in the app designer and i gave me the same error.
function daten_auslesen(h)
name = h.name;
bd = h.bd;
sports = h.sports;
d = h.d;
Handout % Aufruf des Live Scripts
end
2) my second idea was the following code:
import matlab.internal.liveeditor.LiveEditorUtilities
[javaRichDocument, cleanupObj, executionTime] = LiveEditorUtilities.openAndExecute(which('Handout.mlx'));
LiveEditorUtilities.saveas(javaRichDocument, 'report.pdf');
it works! there is no error and i get a pdf file but in the file there the code shown and not the results..
part of the live-script
Auswertung
Patienten Daten:
disp([' Name ',name]);
disp([' Geburtsdatum: ',bd]);
disp([' Sportart: ',sports]);
disp([' Analyse-Datum: ',date]);
Bei Fragen können Sie sich jederzeit unter folgenden Kontaktdaten bei uns melden:
.Can you help me, to get a good solution for my problem, please? Maybe you have another idear or you know a solution for one of my problems....
THANKS
  2 Comments
Mario Malic
Mario Malic on 9 Oct 2020
Edited: Mario Malic on 9 Oct 2020
Then I can move the comment in the answers section. You're welcome, great to hear it worked out!
Edit: Since my answer helped you to solve your problem, can you accept it?
Thank you in advance and have a great weekend!

Sign in to comment.

Answers (2)

Mario Malic
Mario Malic on 9 Oct 2020
  • You can set your Handout as a function that accepts h as an input argument, and call it directly from the App Designer. In this case you could move your publish command to Handout, which would simplify the process a bit (wouldn't know if that command would appear in published document).
  • You can also save the input in a .mat file, and load it within the Handout.

Jana Pecke
Jana Pecke on 9 Oct 2020
thanks for the fast help! It works :-)
your are my hero!

Categories

Find more on Debugging and Analysis 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!