필터 지우기
필터 지우기

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

조회 수: 30 (최근 30일)
Jana Pecke
Jana Pecke 2020년 10월 9일
편집: Mario Malic 2020년 10월 9일
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
Mario Malic
Mario Malic 2020년 10월 9일
Morning,
I admit that I did not understand what code is where, but let's focus on solution 1.
What does the code in function daten_auslesen do? It looks like it just saves the variables in the workspace of that function?
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.
Mario Malic
Mario Malic 2020년 10월 9일
편집: Mario Malic 2020년 10월 9일
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!

댓글을 달려면 로그인하십시오.

답변 (2개)

Mario Malic
Mario Malic 2020년 10월 9일
  • 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 2020년 10월 9일
thanks for the fast help! It works :-)
your are my hero!

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by