MATLAB: Error messeges in MATLAB app designer

app designererror

I have an elaborate MATLAB code and i am now working on a user interface in matlab app designer.
the code contains a long list of error messeges,warnings, and notiications displayed in the command prompt. i would like for the GUI to display these messeges. is there a way to do this without touching the code itself? i mean somehow change the GUI so that any error messeges or warnings are automatically displayed in some form? or simply to display the command prompt as part of my app?
I saw this answer:
but it seems to me a bit of an ugly solution. Is there a better one?
Many thanks
Nathan

Best Answer

Personally I have started using the attached functions (e.g. in my readfile function). With only minimal changes in the syntax of my functions I can catch errors and warnings and redirect them to a log file or to a String property (e.g. a status window). I plan to integrate this in a GUI, similar to what your goal seems to be.
When it comes to errors, these functions assume that an actual error is required (e.g. to trigger a catch-block). Feel free to adapt them to your needs.