At the end of my c# console program, I have made a M file which graph a function in MATLAB, and run it this way:
System.Diagnostics.Process Mfile = new System.Diagnostics.Process();
Mfile.StartInfo.FileName = "M.m";
Mfile.Start();
Is there any way to write a code that when user closes that MATLAB window, a txt file opens? I can open both files together but I'm really interested to know if it is possible to understand when user closes that MATLAB file.