Home > mml > setao.m

setao

PURPOSE ^

SETAO - Set Accelerator Object (AO)

SYNOPSIS ^

function setao(AO)

DESCRIPTION ^

SETAO - Set Accelerator Object (AO)
  setao(AO)
  setao(FileName)
  setao('') to browse for a file

 INPUTS
 1. AO - Accelerator Object

 See also getao

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function  setao(AO)
0002 %SETAO - Set Accelerator Object (AO)
0003 %  setao(AO)
0004 %  setao(FileName)
0005 %  setao('') to browse for a file
0006 %
0007 % INPUTS
0008 % 1. AO - Accelerator Object
0009 %
0010 % See also getao
0011 
0012 %
0013 % Written by Gregory J. Portmann
0014 % Modified by Laurent S. Nadolski
0015 
0016 if nargin < 1
0017     AO = '';
0018 end
0019 
0020 % Browse for filename and directory if using default FileName
0021 if ischar(AO)
0022     if isempty(AO)
0023         DirectoryName = getfamilydata('Directory','OpsData');
0024         [FileName, DirectoryName] = uigetfile('*.mat','Select the desired mode file:', DirectoryName);
0025         if FileName == 0
0026             fprintf('   AO not changed\n');
0027             return
0028         end
0029         
0030         FileName = [DirectoryName FileName];
0031     else
0032         FileName = AO;
0033     end
0034     
0035     try
0036         load(FileName);
0037     catch
0038         try
0039             feval(FileName);
0040         catch
0041             error(sprintf('Could not load or feval %s',FileName));
0042         end
0043     end
0044     
0045     if exist('AcceleratorObjects','var')
0046         AO = AcceleratorObjects;
0047     end
0048     if exist('AcceleratorData','var')
0049         AD = AcceleratorData;
0050     end
0051     
0052     if exist('AD','var')
0053         %tmp = questdlg('Do you want to make the AD variable in this file active as well?','Accelerator Data (AD)','YES','NO','YES');
0054         %if strcmp(tmp,'YES')
0055         setad(AD);
0056         %end
0057     end
0058     
0059     if ~exist('AO','var')
0060         fprintf('   AO or AcceleratorObjects variable does not exist in the file: %s\n', [DirectoryName FileName]);
0061         return
0062     end
0063 end
0064 
0065 
0066 if iscell(AO)
0067     AO = cell2field(AO);
0068 end
0069 
0070 setappdata(0,'AcceleratorObjects', AO);
0071

Generated on Mon 21-May-2007 15:29:18 by m2html © 2003