EASYconsole2.m reformat

This commit is contained in:
2024-07-23 14:12:39 -04:00
parent cbc40c3cac
commit 9179846c04
2 changed files with 295 additions and 756 deletions

601
workflow/templates/easy/EASYconsole.m Executable file → Normal file
View File

@@ -1,55 +1,19 @@
% Launch the MATLAB EASY console % Launch the MATLAB EASY console
% From EstartConsole.m
clear;
clc;
global openExpfile
global openExppath
global newExpfile
global newExppath
global SWnewExp
global ExpOutmat
global ExpPath
global matDir
global resDir
global wCodeDir
global fhconsole
global ImParMat
global scan
% Set working dir as the pwd
wCodeDir=pwd
% Try to enter WCodeDir
function returnHome
global wCodeDir
try
cd(wCodeDir)
catch
msgbox('Failed to enter selected default directory so starting search at root.');
if ispc
cd(fullfile('C:\'));
elseif (isunix | ismac)
cd(fullfile('/mnt/data'));
else
msgbox('Unknown platform')
end
end
% Init
function varargout = EASYconsole(varargin) function varargout = EASYconsole(varargin)
% initialize global variables for function EASYconsole % initialize global variables for function EASYconsole
global ExpOutmat %global ExpOutmat
global ExpPath %global ExpPath
global fhconsole %global fhconsole
global resDir %global resDir
global wCodeDir global wCodeDir
global ImParMat %global ImParMat
wCodeDir=pwd
% changing directory to wCodeDir % changing directory to wCodeDir
returnHome returnStartDir
%% GUI INTERFACE DESIGN %% %% GUI INTERFACE DESIGN %%
% beginning of GUI formation & design, see help GUI or help GUIDE in % beginning of GUI formation & design, see help GUI or help GUIDE in
% command window for more information % command window for more information
gui_Singleton = 1; gui_Singleton = 1;
@@ -68,7 +32,26 @@ function varargout = EASYconsole(varargin)
else else
gui_mainfcn(gui_State, varargin{:}); gui_mainfcn(gui_State, varargin{:});
end end
end
% Try to enter WCodeDir
function returnStartDir
global wCodeDir
try
cd(wCodeDir)
catch
msgbox('Failed to enter selected default directory so starting search at root.');
if ispc
cd('C:\');
elseif (isunix || ismac)
cd('/mnt/data');
else
msgbox('Unknown platform')
end
end
end
% GUI % GUI
% Easyconcole_OpeningFcn executes just before the EASYconsole GUI is made visible. % Easyconcole_OpeningFcn executes just before the EASYconsole GUI is made visible.
% This function has no output args, see OutputFcn. % This function has no output args, see OutputFcn.
@@ -77,13 +60,11 @@ function varargout = EASYconsole(varargin)
% handles--structure with handles and user data (see GUIDATA) % handles--structure with handles and user data (see GUIDATA)
% varargin--input arguments to EASYconsole (see VARARGIN) % varargin--input arguments to EASYconsole (see VARARGIN)
function EASYconsole_OpeningFcn(hObject, ~, handles, varargin) function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
%global ExpOutmat
global ExpOutmat %global ExpPath
global ExpPath global fhconsole
global fhconsole global resDir
global resDir %global ImParMat
global wCodeDir
global ImParMat
% Choose default command line output for EASYconsole % Choose default command line output for EASYconsole
handles.output = hObject; handles.output = hObject;
@@ -101,8 +82,10 @@ function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
else else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.') set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end end
end
% Output
%% EASYconsole OUTPUT FUNCTION %%
% Outputs from this function are returned to the command line. % Outputs from this function are returned to the command line.
% varargout--cell array for returning output args (see VARARGOUT); % varargout--cell array for returning output args (see VARARGOUT);
% hObject--handle to figure % hObject--handle to figure
@@ -111,15 +94,18 @@ function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
function varargout = EASYconsole_OutputFcn(~, ~, handles) function varargout = EASYconsole_OutputFcn(~, ~, handles)
% Get default command line output from handles structure % Get default command line output from handles structure
varargout{1} = handles.output; varargout{1} = handles.output;
end
%% CONSOLE BUTTON INTERFACES %% %% CONSOLE BUTTON INTERFACES %%
% File Button Interface % File Button Interface
function FileMenu_Callback(~, ~, ~) function FileMenu_Callback(~, ~, ~)
returnHome returnStartDir
end
% Load Experiment Button Interface % Load Experiment Button Interface
function LoadExp_Callback(~, ~, ~) function LoadExp_Callback(~, ~, ~)
returnHome returnStartDir
end
% New Experiment Button Interface % New Experiment Button Interface
function NewExpDat_Callback(~, ~, ~) function NewExpDat_Callback(~, ~, ~)
@@ -130,298 +116,301 @@ function NewExpDat_Callback(~, ~, ~)
global ExpPath global ExpPath
global matDir global matDir
global resDir global resDir
global wCodeDir
global fhconsole global fhconsole
global scan global scan
% CREATE NEW EXPERIMENT %
try
questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the image folders.','File Creation','OK', struct('Default','OK','Interpreter','tex'));
[newExpfile,newExppath] = uiputfile(' .mat');
SWnewExp=1;
returnHome
newExpfilePref= strrep(newExpfile,'.mat','');
resDirName=strcat('Results',datestr(now,29),newExpfilePref);
% creation of the Results file
if ~exist(fullfile(newExppath,resDirName,'matResults'))
mkdir (fullfile(newExppath,resDirName,'matResults'));
end
% assigning paths to global variables
resDir= fullfile(newExppath,resDirName);
matDir= fullfile(newExppath,resDirName,'matResults');
ExpOutmat=fullfile(matDir,strcat(datestr(now,29),newExpfile));
ExpPath= fullfile(newExppath);
% Added for 'parfor global' to preallocate 'scan' structure 20-0123 % put all users on same working directory
nlist=dir(fullfile(ExpPath,'*')); returnStartDir
nnn=0;
for n=1:size(nlist,1)
if (~isempty(str2num(nlist(n).name)))
nnn=nnn+1;
PnumLst(nnn)= (str2num(nlist(n).name));
sl(nnn,1)={(nlist(n).name)};
end
end
scanSize= size(sl,1);
scanMax= max(str2double(sl));
clear scan;
scan(scanMax)= struct(); %changed for parfor global 20_0118
save(ExpOutmat,'scan')
% create 'PrintResults' file
if ~exist(fullfile(ExpPath,resDirName,'PrintResults'))
mkdir(fullfile(ExpPath,resDirName,'PrintResults'));
end
% copy 'figs' file and place it in ExpPath Directory
if ~exist(fullfile(ExpPath,resDirName,'figs'))
copyfile((fullfile(wCodeDir,'figs')), (fullfile(ExpPath,resDirName,'figs')))
end
% create 'CFfigs' file
if ~exist(fullfile(ExpPath,resDirName,'CFfigs'))
mkdir(fullfile(ExpPath,resDirName,'CFfigs'));
end
% copy 'PTmats' file and place it in ExpPath Directory
if ~exist(fullfile(ExpPath,resDirName,'PTmats'))
copyfile((fullfile(wCodeDir,'PTmats')), (fullfile(ExpPath,resDirName,'PTmats')))
end
% create 'Fotos' file
if ~exist(fullfile(ExpPath,resDirName,'Fotos'))
mkdir(fullfile(ExpPath,resDirName,'Fotos'));
clear sbdg % reduce possible retention of a previous job sdbg
sbdg= cell(1,scanMax);
save((fullfile(resDir,'Fotos','Nbdg')),'sbdg');
end
% create backup 'Fotos' file
if ~exist(fullfile(ExpPath,resDirName,'Fotos','BkUp'))
mkdir(fullfile(ExpPath,resDirName,'Fotos','BkUp'));
end
catch ME % Create a new experiment
returnHome try
disp('Error Creating a New Experiment. Loc: EASYconsole.m Lines 106-197') questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the image folders.','File Creation','OK', struct('Default','OK','Interpreter','tex'));
end [newExpfile,newExppath] = uiputfile(' .mat');
SWnewExp=1;
% set the title for fhconsole depending on existence % Set paths
if exist('resDir','var')&&~isempty(resDir) newExpfilePref= strrep(newExpfile,'.mat','');
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir))) resDirName=strcat('Results',datestr(now,29),newExpfilePref);
else resDir=fullfile(newExppath,resDirName);
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.') matDir=fullfile(newExppath,resDirName,'matResults');
end ExpOutmat=fullfile(matDir,strcat(datestr(now,29),newExpfile));
ExpPath=fullfile(newExppath);
% create the the matResults dir
if ~exist(matDir)
mkdir (matDir);
end
%***Added for 'parfor global' to preallocate 'scan' structure 20-0123*****
nlist=dir(fullfile(ExpPath,'*'));
nnn=0;
for n=1:size(nlist,1)
if (~isempty(str2num(nlist(n).name)))
nnn=nnn+1;
PnumLst(nnn)= (str2num(nlist(n).name));
sl(nnn,1)={(nlist(n).name)};
end
end
scanSize= size(sl,1);
scanMax= max(str2double(sl));
clear scan;
scan(scanMax)= struct(); %changed for parfor global 20_0118
save(ExpOutmat,'scan')
% create supporting dirs
dirs = {'PrintResults', 'CFfigs', 'Fotos', 'Fotos/BkUp'};
for i = 1:length(dirs)
d = dirs{i};
if ~exist(fullfile(ExpPath, resDirName, d), 'dir')
mkdir(fullfile(ExpPath, resDirName, d));
end
end
% templateDirs are stored in the easy template directory
templates = {'figs', 'PTmats'}
for i = 1:length(templates)
d = dirs{i};
if ~exist(fullfile(ExpPath, resDirName, d), 'dir')
copyfile((fullfile(wCodeDir,d)), (fullfile(ExpPath,resDirName,d)));
end
end
clear sbdg % reduce possible retention of a previous job sdbg
sbdg= cell(1,scanMax);
save((fullfile(resDir,'Fotos','Nbdg')),'sbdg');
catch ME
returnStartDir
disp('Error Creating a New Experiment')
end
% set the title for fhconsole depending on existence
if exist('resDir','var')&&~isempty(resDir)
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)))
else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
end
% Load a previous experiment % Load a previous experiment
% Load Experiment Analysis directory/file structure
function LoadDatFile_Callback(~, ~, ~) function LoadDatFile_Callback(~, ~, ~)
global openExpfile global openExpfile
global openExppath global openExppath
global SWnewExp global SWnewExp
global ExpOutmat global ExpOutmat
global ExpPath global ExpPath
global matDir global matDir
global resDir global resDir
global wCodeDir global fhconsole
global fhconsole %global ImParMat
global ImParMat
returnHome returnStartDir
questdlg('\fontsize{20} Load file from ExpJobs/YourJob/YourResults/matResults','File Creation','OK', struct('Default','OK','Interpreter','tex')); % TODO this entire try block needs work
[openExpfile,openExppath] = uigetfile('.mat','Open Experiment folder and data storage .mat file name','MultiSelect','off'); try
SWnewExp=0; % TODO this section is highly questionable
questdlg('\fontsize{20} Load file from ExpJobs/YourJob/YourResults/matResults','File Creation','OK', struct('Default','OK','Interpreter','tex'));
ExpOutmat= fullfile(openExppath,openExpfile); [openExpfile,openExppath] = uigetfile('.mat','Open Experiment folder and data storage .mat file name','MultiSelect','off');
load(ExpOutmat); SWnewExp=0;
ExpOutmat= fullfile(openExppath,openExpfile);
cd(openExppath) load(ExpOutmat);
cd ..; resdir=fullfile('../',openExppath)
resDir=pwd; ExpPath=fullfile('../../',openExppath)
cd ..;
ExpPath=pwd;
cd (wCodeDir)
ExpPath= fullfile(ExpPath);
if isfolder(fullfile(openExppath, '..','..','1')) %If Inovation Vrobot Then
if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
load(fullfile(resDir,'PTmats','NImParameters.mat'));
else
curDir=pwd;
returnHome
load NImParameters.mat
cd(curDir)
end
else %If Epson 10Plate Scans Then>
if exist(fullfile(resDir,'PTmats','ImParameters.mat'))
load(fullfile(resDir,'PTmats','ImParameters.mat'));
else
curDir=pwd;
returnHome
load ImParameters.mat
cd(curDir)
end
end
matDir= fullfile(openExppath,'\');
mkdir(fullfile(matDir,'BkUp'));
% create supporting files
if ~exist(fullfile(resDir,'PrintResults'))
mkdir(fullfile(resDir,'PrintResults'));
end
if ~exist(fullfile(resDir,'figs'))
mkdir(fullfile(resDir,'figs'));
end
if ~exist(fullfile(resDir,'CFfigs'))
mkdir(fullfile(resDir,'CFfigs'));
end
if ~exist(fullfile(resDir,'PTmats'))
mkdir(fullfile(resDir,'PTmats'));
end
if ~exist(fullfile(resDir,'Fotos'))
mkdir(fullfile(resDir,'Fotos'));
end
clear scan
if exist('resDir','var')&&~isempty(resDir)
fhconsole= gcf;
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)))
else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
if isfolder(fullfile(openExppath, '..','..','1')) %If Inovation Vrobot Then
if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
load(fullfile(resDir,'PTmats','NImParameters.mat'));
else
curDir=pwd;
returnStartDir
load NImParameters.mat
cd(curDir)
end
else %If Epson 10Plate Scans Then>
if exist(fullfile(resDir,'PTmats','ImParameters.mat'))
load(fullfile(resDir,'PTmats','ImParameters.mat'));
else
curDir=pwd;
returnStartDir
load ImParameters.mat
cd(curDir)
end
end
mkdir(fullfile(openExppath,'\BkUp'));
% create supporting dirs
dirs = {'PrintResults', 'figs', 'CFfigs', 'PTmats', 'Fotos'}
for i = 1:length(dirs)
d = dirs{i}
if ~exist(fullfile(resDir, d), 'dir')
mkdir(fullfile(resDir, d));
end
end
catch
returnStartDir
end
clear scan
if exist('resDir','var')&&~isempty(resDir)
fhconsole= gcf;
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)))
else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
end
%% CALLBACKS %% %% CALLBACKS %%
% callback for the 'Run' in the dropdown menu % callback for the 'Run' in the dropdown menu
function run_Callback(~, ~, ~) function run_Callback(~, ~, ~)
returnHome returnStartDir
end
function runPlateMapPintool_Callback(~, ~, ~) function runPlateMapPintool_Callback(~, ~, ~)
returnHome returnStartDir
try try
NImapPT NImapPT
catch ME catch ME
returnHome returnStartDir
EASYconsole EASYconsole
end end
end
function NImCFcombo_Callback(~, ~, ~) function NImCFcombo_Callback(~, ~, ~)
returnHome returnStartDir
try try
par4Gbl_Main8c par4Gbl_Main8c
catch catch
returnHome returnStartDir
EASYconsole EASYconsole
end end
end
function runPlateImAnal_Callback(~, ~, ~) function runPlateImAnal_Callback(~, ~, ~)
returnHome returnStartDir
try try
NImStartupOnly NImStartupOnly
catch ME catch ME
returnHome returnStartDir
EASYconsole EASYconsole
end end
end
function PlateCFit_Callback(~, ~, ~) function PlateCFit_Callback(~, ~, ~)
returnHome %global ExpOutmat
try returnStartDir
NCstart try
catch ME NCstart
returnHome catch ME
end returnStartDir
end
end
function GenPrintouts_Callback(~, ~, ~) function GenPrintouts_Callback(~, ~, ~)
end
function uploadExcelMP2DB_Callback(~, ~, ~) function uploadExcelMP2DB_Callback(~, ~, ~)
end
function runDMPexcel_Callback(~, ~, ~) function runDMPexcel_Callback(~, ~, ~)
try global ExpPath
DMPexcel2mat try
catch ME DMPexcel2mat_2024winLinix %DMPexcel2mat_2023winLinix
returnHome catch ME
EASYconsole returnStartDir
end EASYconsole
end
end
function runResults_DBcombo_Callback(~, ~, ~) function runResults_DBcombo_Callback(~, ~, ~)
try
DgenResults %similar but semicolons removed to restore so cmdLine display info.
%DgenResults %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
catch ME
disp('Error in DgenResults')
returnHome
EASYconsole
end
% function Tools_Callback(~, ~, ~) try
DgenResults240430 %similar but semicolons removed to restore so cmdLine display info.
%Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
catch ME
disp('Error in DgenResults240430')
returnStartDir
EASYconsole
end
end
function Tools_Callback(~, ~, ~)
end
function runOverlayPlots_Callback(~, ~, ~) function runOverlayPlots_Callback(~, ~, ~)
returnHome returnStartDir
try try
DoverlayPlots2 DoverlayPlots2
returnHome returnStartDir
EASYconsole EASYconsole
catch ME catch ME
returnHome returnStartDir
EASYconsole EASYconsole
end end
end
function runFotoStrip_Callback(~, ~, ~) function runFotoStrip_Callback(~, ~, ~)
returnHome returnStartDir
try try
F_NImStartup_CentCir F_NImStartup_CentCir
returnHome returnStartDir
EASYconsole EASYconsole
catch ME catch ME
returnHome returnStartDir
EASYconsole EASYconsole
end end
end
function runDisplayFig_Callback(~, ~, ~) function runDisplayFig_Callback(~, ~, ~)
returnHome returnStartDir
try try
UfigDisplay UfigDisplay
catch ME catch ME
returnHome returnStartDir
EASYconsole EASYconsole
end end
end
function runViewParameters_Callback(~, ~, ~) function runViewParameters_Callback(~, ~, ~)
returnHome returnStartDir
try try
% This was blank in original catch ME
catch ME returnStartDir
returnHome EASYconsole
EASYconsole end
end end
function QkviewN_Callback(~, ~, ~) function QkviewN_Callback(~, ~, ~)
global ExpPath returnStartDir
returnHome try
try try
try cd(fullfile(ExpPath))
cd fullfile(ExpPath) catch
catch if ispc
if ispc cd c:\ cd('C:\')
else else
cd (fullfile('~')); cd(fullfile('~'));
end end
end end
QkviewImages QkviewImages
catch ME catch ME
returnHome returnStartDir
EASYconsole EASYconsole
end end
end
function CFdisplay_Callback(~, ~, ~) function CFdisplay_Callback(~, ~, ~)
returnHome returnStartDir
try try
NCsingleDisplay NCsingleDisplay
returnHome returnStartDir
EASYconsole EASYconsole
catch ME catch ME
returnHome returnStartDir
EASYconsole EASYconsole
end end
end

View File

@@ -1,450 +0,0 @@
% Launch the MATLAB EASY console
function varargout = EASYconsole(varargin)
% initialize global variables for function EASYconsole
global ExpOutmat
global ExpPath
global fhconsole
global resDir
global wCodeDir
global ImParMat
% changing directory to wCodeDir
returnHome
%% GUI INTERFACE DESIGN %%
% beginning of GUI formation & design, see help GUI or help GUIDE in
% command window for more information
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @EASYconsole_OpeningFcn, ...
'gui_OutputFcn', @EASYconsole_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
end
% Try to enter WCodeDir
function returnHome
global wCodeDir
try
cd(wCodeDir)
catch
msgbox('Failed to enter selected default directory so starting search at root.');
if ispc
cd(fullfile('C:\'));
elseif (isunix | ismac)
cd(fullfile('/mnt/data'));
else
msgbox('Unknown platform')
end
end
end
% GUI
% Easyconcole_OpeningFcn executes just before the EASYconsole GUI is made visible.
% This function has no output args, see OutputFcn.
% hObject--handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles--structure with handles and user data (see GUIDATA)
% varargin--input arguments to EASYconsole (see VARARGIN)
function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
global ExpOutmat
global ExpPath
global fhconsole
global resDir
global wCodeDir
global ImParMat
% Choose default command line output for EASYconsole
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
%Figure header, Toolbar, etc. Setup
fhconsole=gcf;
set(fhconsole,'Toolbar','none');
fhconsole=gcf;
if exist('resDir','var')&&~isempty(resDir)
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)));
else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
end
%% EASYconsole OUTPUT FUNCTION %%
% Outputs from this function are returned to the command line.
% varargout--cell array for returning output args (see VARARGOUT);
% hObject--handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles--structure with handles and user data (see GUIDATA)
function varargout = EASYconsole_OutputFcn(~, ~, handles)
% Get default command line output from handles structure
varargout{1} = handles.output;
end
%% CONSOLE BUTTON INTERFACES %%
% File Button Interface
function FileMenu_Callback(~, ~, ~)
returnHome
end
% Load Experiment Button Interface
function LoadExp_Callback(~, ~, ~)
returnHome
end
% New Experiment Button Interface
function NewExpDat_Callback(~, ~, ~)
global newExpfile
global newExppath
global SWnewExp
global ExpOutmat
global ExpPath
global matDir
global resDir
global wCodeDir
global fhconsole
global scan
% put all users on same working directory
returnHome
% Create a new experiment
try
questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the image folders.','File Creation','OK', struct('Default','OK','Interpreter','tex'));
[newExpfile,newExppath] = uiputfile(' .mat');
SWnewExp=1;
cd (wcode)
newExpfilePref= strrep(newExpfile,'.mat','');
resDirName=strcat('Results',datestr(now,29),newExpfilePref);
% creation of the Results file
if ~exist(fullfile(newExppath,resDirName,'matResults'))
mkdir (fullfile(newExppath,resDirName,'matResults'));
end
% assigning paths to global variables
resDir= fullfile(newExppath,resDirName);
matDir= fullfile(newExppath,resDirName,'matResults');
ExpOutmat=fullfile(matDir,strcat(datestr(now,29),newExpfile));
ExpPath= fullfile(newExppath);
%***Added for 'parfor global' to preallocate 'scan' structure 20-0123*****
nlist=dir(fullfile(ExpPath,'*'));
nnn=0;
for n=1:size(nlist,1)
if (~isempty(str2num(nlist(n).name)))
nnn=nnn+1;
PnumLst(nnn)= (str2num(nlist(n).name));
sl(nnn,1)={(nlist(n).name)};
end
end
scanSize= size(sl,1);
scanMax= max(str2double(sl));
clear scan;
scan(scanMax)= struct(); %[]; %changed for parfor global 20_0118
save(ExpOutmat,'scan')
% create 'PrintResults' file
if ~exist(fullfile(ExpPath,resDirName,'PrintResults'))
mkdir(fullfile(ExpPath,resDirName,'PrintResults'));
end
% copy 'figs' file and place it in ExpPath Directory
if ~exist(fullfile(ExpPath,resDirName,'figs'))
copyfile((fullfile(wCodeDir,'figs')), (fullfile(ExpPath,resDirName,'figs')))
end
% create 'CFfigs' file
if ~exist(fullfile(ExpPath,resDirName,'CFfigs'))
mkdir(fullfile(ExpPath,resDirName,'CFfigs'));
end
% copy 'PTmats' file and place it in ExpPath Directory
if ~exist(fullfile(ExpPath,resDirName,'PTmats'))
copyfile((fullfile(wCodeDir,'PTmats')), (fullfile(ExpPath,resDirName,'PTmats')))
end
% create 'Fotos' file
if ~exist(fullfile(ExpPath,resDirName,'Fotos'))
mkdir(fullfile(ExpPath,resDirName,'Fotos'));
clear sbdg % reduce possible retention of a previous job sdbg
sbdg= cell(1,scanMax);
save((fullfile(resDir,'Fotos','Nbdg')),'sbdg');
end
% create backup 'Fotos' file
if ~exist(fullfile(ExpPath,resDirName,'Fotos','BkUp'))
mkdir(fullfile(ExpPath,resDirName,'Fotos','BkUp'));
end
catch ME
returnHome
disp('Error Creating a New Experiment')
end
% set the title for fhconsole depending on existence
if exist('resDir','var')&&~isempty(resDir)
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)))
else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
end
% Load a previous experiment
function LoadDatFile_Callback(~, ~, ~)
global openExpfile
global openExppath
global SWnewExp
global ExpOutmat
global ExpPath
global matDir
global resDir
global wCodeDir
global fhconsole
global ImParMat
returnHome
% TODO this entire try block needs work
try
% TODO this section is highly questionable
questdlg('\fontsize{20} Load file from ExpJobs/YourJob/YourResults/matResults','File Creation','OK', struct('Default','OK','Interpreter','tex'));
[openExpfile,openExppath] = uigetfile('.mat','Open Experiment folder and data storage .mat file name','MultiSelect','off');
SWnewExp=0;
ExpOutmat= fullfile(openExppath,openExpfile);
load(ExpOutmat);
cd(openExppath)
cd ..;
resDir=pwd;
cd ..;
ExpPath=pwd;
cd (wcode)
ExpPath= fullfile(ExpPath);
if isfolder(fullfile(openExppath, '..','..','1')) %If Inovation Vrobot Then
if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
load(fullfile(resDir,'PTmats','NImParameters.mat'));
else
curDir=pwd;
returnHome
load NImParameters.mat
cd(curDir)
end
else %If Epson 10Plate Scans Then>
if exist(fullfile(resDir,'PTmats','ImParameters.mat'))
load(fullfile(resDir,'PTmats','ImParameters.mat'));
else
curDir=pwd;
returnHome
load ImParameters.mat
cd(curDir)
end
end
matDir= fullfile(openExppath,'\');
mkdir(fullfile(matDir,'BkUp'));
% create supporting files
if ~exist(fullfile(resDir,'PrintResults'))
mkdir(fullfile(resDir,'PrintResults'));
end
if ~exist(fullfile(resDir,'figs'))
mkdir(fullfile(resDir,'figs'));
end
if ~exist(fullfile(resDir,'CFfigs'))
mkdir(fullfile(resDir,'CFfigs'));
end
if ~exist(fullfile(resDir,'PTmats'))
mkdir(fullfile(resDir,'PTmats'));
end
if ~exist(fullfile(resDir,'Fotos'))
mkdir(fullfile(resDir,'Fotos'));
end
catch
returnHome
end
clear scan
if exist('resDir','var')&&~isempty(resDir)
fhconsole= gcf;
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)))
else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
end
%% CALLBACKS %%
% callback for the 'Run' in the dropdown menu
function run_Callback(~, ~, ~)
returnHome
end
function runPlateMapPintool_Callback(~, ~, ~)
returnHome
try
NImapPT
catch ME
returnHome
EASYconsole
end
end
function NImCFcombo_Callback(~, ~, ~)
returnHome
try
par4Gbl_Main8c
catch
returnHome
EASYconsole
end
end
function runPlateImAnal_Callback(~, ~, ~)
returnHome
try
NImStartupOnly
catch ME
returnHome
EASYconsole
end
end
function PlateCFit_Callback(~, ~, ~)
global ExpOutmat
returnHome
try
NCstart
catch ME
returnHome
end
end
function GenPrintouts_Callback(~, ~, ~)
end
function uploadExcelMP2DB_Callback(~, ~, ~)
end
function runDMPexcel_Callback(~, ~, ~)
global ExpPath
try
DMPexcel2mat_2024winLinix %DMPexcel2mat_2023winLinix
catch ME
returnHome
EASYconsole
end
end
function runResults_DBcombo_Callback(~, ~, ~)
try
DgenResults240430 %similar but semicolons removed to restore so cmdLine display info.
%Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
catch ME
disp('Error in DgenResults240430')
returnHome
EASYconsole
end
end
function Tools_Callback(~, ~, ~)
end
function runOverlayPlots_Callback(~, ~, ~)
returnHome
try
DoverlayPlots2
returnHome
EASYconsole
catch ME
returnHome
EASYconsole
end
end
function runFotoStrip_Callback(~, ~, ~)
returnHome
try
F_NImStartup_CentCir
returnHome
EASYconsole
catch ME
returnHome
EASYconsole
end
end
function runDisplayFig_Callback(~, ~, ~)
returnHome
try
UfigDisplay
catch ME
returnHome
EASYconsole
end
end
function runViewParameters_Callback(~, ~, ~)
returnHome
try
catch ME
returnHome
EASYconsole
end
end
function QkviewN_Callback(~, ~, ~)
returnHome
try
try
cd(fullfile(ExpPath))
catch
if ispc
cd('C:\')
else
cd(fullfile('~'));
end
end
QkviewImages
catch ME
returnHome
EASYconsole
end
end
function CFdisplay_Callback(~, ~, ~)
returnHome
try
NCsingleDisplay
returnHome
EASYconsole
catch ME
returnHome
EASYconsole
end
end