Home > src > getdfName.m

getdfName

PURPOSE ^

- extracts a dataframe name selected in the GUI

SYNOPSIS ^

function dfName = getdfName(handle,dfType)

DESCRIPTION ^

 -  extracts a dataframe name selected in the GUI

 copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut

    This file is part of SOS

    SOS is free software: you can redistribute it and/or modify
    it for academic and non-commercial purposes
    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.  For commercial or for-profit
    uses, please contact the authors (sos@cnbc.cmu.edu).

    SOS 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.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % -  extracts a dataframe name selected in the GUI
0002 %
0003 % copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut
0004 %
0005 %    This file is part of SOS
0006 %
0007 %    SOS is free software: you can redistribute it and/or modify
0008 %    it for academic and non-commercial purposes
0009 %    under the terms of the GNU General Public License as published by
0010 %    the Free Software Foundation, either version 3 of the License, or
0011 %    (at your option) any later version.  For commercial or for-profit
0012 %    uses, please contact the authors (sos@cnbc.cmu.edu).
0013 %
0014 %    SOS is distributed in the hope that it will be useful,
0015 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017 %    GNU General Public License for more details.
0018 
0019 %    You should have received a copy of the GNU General Public License
0020 %    along with SOS (see COPYING.txt).
0021 %    If not, see <http://www.gnu.org/licenses/>.
0022 
0023 
0024 % returns the string label of the dataframe (techically and more generally now, the
0025 % name of the object) that has been selected in a gui popup menu.
0026 function dfName = getdfName(handle,dfType)    
0027     %% returns the string label (name) of an object in a gui popup menu
0028     
0029     dfNum = get(handle,'Value');
0030     dfNames = get(handle,'String');
0031     
0032     if isempty(dfNames) == 0
0033         if ischar(dfNames) % for if there is only one entry in the list
0034             dfName = dfNames;
0035         else
0036             dfName = dfNames{dfNum};
0037         end
0038     else
0039         dfName = '';
0040     end    
0041 
0042     %make sure there is an active df
0043     if isempty(dfName) == 0
0044         % success
0045     else
0046         msgbox(['A ',dfType,' must be active'],...
0047                 ['No active ',dfType]);  
0048     end
0049 
0050

Generated on Fri 27-Jan-2012 16:18:41 by m2html © 2005