How can I insert a code that is in the MATLAB function block of my model in a report?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ander Erroicenea
el 27 de Mzo. de 2020
Respondida: Rahul Singhal
el 27 de Mzo. de 2020
I'm using find_system to find all the subsystems and then strcmp(get_param(subsystem, 'SFBlockType'), 'MATLAB Function') to obtain the MATLAB function blocks. Once I find the block I'm not able to take the code and export to the report. I know that it's possible using slreportgen.report.MATLABFunction, but in that case, to create the report I'm using the DOM API report so I cannot extract the code and write in my report with this class. Does anyone know how can I put the code in my report?
0 comentarios
Respuesta aceptada
Fangjun Jiang
el 27 de Mzo. de 2020
myMFBConfigobj = get_param(gcb, 'MATLABFunctionConfiguration')
The source code is in .FunctionScript
web(fullfile(docroot, 'simulink/slref/simulink.matlabfunction.matlabfunctionconfiguration.html'))
0 comentarios
Más respuestas (1)
Rahul Singhal
el 27 de Mzo. de 2020
Another solution is to first get the Stateflow chart object and then obtain the script code as below:
>> chart = slreportgen.utils.block2chart(gcb);
>> code = chart.Script;
I would also encourage you to convert your DOM API script to Report API as in that case you can directly use the slreportgen.report.MATLABFunction reporter which automatically inserts syntax-highlighted code in the report.
0 comentarios
Ver también
Categorías
Más información sobre Simulink Report Generator en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!