I am using the command applicationCompiler -package harmonic_viewer.prj
to compile a MATLAB program for distribution. Sometimes I miss a file and the application compiler throws an error. I would like to catch such errors and pass the error up to terminate a Windows batch script that compiles a number of programs.
It seems from the documentation that applicationCompiler does not return a pass/fail result. It does throw an error that appears in red in the MATLAB command window. I believe I should be able to catch the error in a try-catch-end block, but it does not work for me. Here is an example session
>> try
applicationCompiler -package harmonic_viewer.prj
catch me
disp('ac error')
end
Error: Caught exception when packaging project: C:\build_matlab\source\harmonic_viewer\harmonic_viewer.prj
com.mathworks.project.api.InvalidProjectException
File filteredunwrap.m from Files required for your application to run does not exist.
>>
I expected the try-catch-end block to trap the error and print 'ac error'.
Can anyone see what I am doing wrong?
I am using MATLAB r2014a on 64 bit Windows 7.