How can I capture child function/script workspace/variables if it errors out?

1 view (last 30 days)
What I'm trying to do is create a way to capture all of the variables from a script in the event that it errors out as I don't know all of the ways it is possible for the script to error out.
The script is compiled into an executable and is run by people other than myself in its full operation. I'm wanting to be able to capture the variables in such a manner that I will be able to view the data from the computers the script is run on rather than having to copy the data to a computer with Matlab in order to figure out the point of failure.
I already know of Try/Catch in its basic forms. I was originally hoping to be able to create a shell script that would run the main script and grab the variables in this manner but I'm unsure if this is even possible after searching for a couple of hours for a method to do what I wish. I am not wanting to selectively pass each individual variable. I have method that would work in the main script for grabbing all of the data and passing it in a structure to its own child functions, specifically a GUI, and I know it's possible to pass backwards but not necessarily grab. I already know that people frown on the use of things like evalin and eval and feval. This isn't my particular care right now. I just want a method to capture these variables.
Regarding the idea of copying all of the variables, I already know it's a bad idea especially in my situation which has multitudes of variables that are quite large in size. I have yet to have a reasonable method of storing the data. I have a feeling notepad files will not be particularly efficient. I would also be great to know exactly what the script was attempting to do when it fails, so something along the lines of capturing the previous 10 lines of code that were run leading up to the error.

Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!