I am tring to continue matlab script execution after polyspacecodeprover function showing error in matlab window. but matlab close script execution .

2 views (last 30 days)
Sonali Patil
Sonali Patil on 8 Dec 2020
Commented: Sonali Patil on 2 Feb 2021
I want to continue matlab script execution after polyspacecodeprover function fail for that I tried with try-catch condition, but when polyspace function fails, directly script execution will stop.
can any commands available in polyspacecodeprover function for return in matlab?
mycode ->
function return = polyspace()
'-I',includeFileName, ...
return = 1
return = 0

Accepted Answer

Anirban on 8 Dec 2020
Edited: Anirban on 8 Dec 2020
I am guessing when you mention failure of the polyspace function, you mean a failure because of compilation errors in the source code or some such thing. In those cases, a better approach would be to poll the return value of the polyspaceCodeProver function, like so:
status = polyspaceCodeProver('-sources',sourceFileName,...
'-I',includeFileName, ...
If the verification fails, the function returns 1 to the status variable, otherwise 0.
A similar approach is given for the polyspace.Project object in Troubleshoot Polyspace Analysis from MATLAB. This object provides a cleaner way to run Polyspace from MATLAB. So, you can also use this object instead of the polyspaceCodeProver function.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by