//Matlab /// <summary> /// Checks to see if Matlab is still open and asks to Reload the logged data and reopens matlab. /// </summary> /// <param name="showDialog"> Whether to show a dialog with yes or no.</param> public void checkMatlab(bool showDialog) { if (showDialog) { bool hasMatlab = MatlabAccess.isMatlabOpen(); if (!hasMatlab && !checkedMatlab) { DialogResult result1 = MessageBox.Show(" Matlab has been closed. Do you want to reopen Matlab and load with Logged inputs? To start with an empty workspace, click No.", "Matlab has Closed", MessageBoxButtons.YesNoCancel); if (result1 == DialogResult.Yes) { MatlabAccess.MatlabStartup(); LogSystem.SaveLog("temp.txt"); LogSystem.Clear(); importLog("temp.txt"); checkedMatlab = false; } else if (result1 == DialogResult.No) { MatlabAccess.MatlabStartup(); } else { checkedMatlab = true; } } } else { MatlabAccess.MatlabStartup(); LogSystem.SaveLog("temp.txt"); LogSystem.Clear(); importLog("temp.txt"); checkedMatlab = false; } }
/// <summary> /// Starts up the Desktop Matlab or attaches to COM-Enabled Matlab. /// to Com-Enable Matlab use [ enableservice('AutomationServer',true);] /// </summary> public MainControl() { // Matlab Startup and Connection to Desktop MatlabAccess.MatlabStartup(); checkedMatlab = false; }