loadCellData : used to load a cell file given it's number INPUT : num : number of cell dirname_cell : directory with cell files handles : used for the gui version OUTPUT : data_cell : loaded cell file cell_name : name of file loaded Copyright (C) 2016 Wiggins Lab Written by Stella Stylianidou, Paul Wiggins. University of Washington, 2016 This file is part of SuperSegger. SuperSegger is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SuperSegger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SuperSegger. If not, see <http://www.gnu.org/licenses/>.
0001 function [data_cell,cell_name] = loadCellData(num, dirname_cell, handles) 0002 % loadCellData : used to load a cell file given it's number 0003 % 0004 % INPUT : 0005 % num : number of cell 0006 % dirname_cell : directory with cell files 0007 % handles : used for the gui version 0008 % OUTPUT : 0009 % data_cell : loaded cell file 0010 % cell_name : name of file loaded 0011 % 0012 % Copyright (C) 2016 Wiggins Lab 0013 % Written by Stella Stylianidou, Paul Wiggins. 0014 % University of Washington, 2016 0015 % This file is part of SuperSegger. 0016 % 0017 % SuperSegger is free software: you can redistribute it and/or modify 0018 % it under the terms of the GNU General Public License as published by 0019 % the Free Software Foundation, either version 3 of the License, or 0020 % (at your option) any later version. 0021 % 0022 % SuperSegger is distributed in the hope that it will be useful, 0023 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0024 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0025 % GNU General Public License for more details. 0026 % 0027 % You should have received a copy of the GNU General Public License 0028 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0029 0030 0031 0032 data_cell = []; 0033 cell_name = []; 0034 0035 padStr = getPadSize(dirname_cell, handles); 0036 0037 if ~isempty( padStr ) 0038 data_cell = []; 0039 filename_cell_C = [dirname_cell,'Cell',num2str(num,padStr),'.mat']; 0040 filename_cell_c = [dirname_cell,'cell',num2str(num,padStr),'.mat']; 0041 else 0042 return; 0043 end 0044 if exist(filename_cell_C, 'file' ) 0045 filename_cell = filename_cell_C; 0046 cell_name = ['Cell',num2str(num,padStr),'.mat']; 0047 elseif exist(filename_cell_c, 'file' ) 0048 filename_cell = filename_cell_c; 0049 cell_name = ['cell',num2str(num,padStr),'.mat']; 0050 else 0051 if isempty(handles) 0052 disp(['Files: ',filename_cell_C,' and ',filename_cell_c,' do not exist.']); 0053 else 0054 handles.message.String = ['Files: ',filename_cell_C,' and ',filename_cell_c,' do not exist.']; 0055 end 0056 return; 0057 end 0058 try 0059 data_cell = load( filename_cell ); 0060 catch 0061 if isempty(handles) 0062 disp(['Error loading: ', filename_cell]); 0063 else 0064 handles.message.String = ['Error loading: ', filename_cell]; 0065 end 0066 end