⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fdcinit.m

📁 matlab的FDC工具箱
💻 M
📖 第 1 页 / 共 2 页
字号:

                     j = j+1;

                     % New subdirectory stored into cell-array newsubs
                     % -----------------------------------------------
                     newsubs{j} = newname;

                  elseif answ2 == 'd'

                     % Don't store a directoryname in newsubs (has the same
                     % effect as deleting a directoryname from the variable
                     % subdirs!).
                     % -------------------------------------------------
                     disp(' ');
                     disp(['subdirectory ' subdirs{i} ' deleted!']);

                  else
                     j = j+1;

                     % Store old subdirectory from FDC.INI or the default 
                     % directories (used if FDC.INI does not yet exist)
                     % without changes into the cell-array newsubs.
                     % --------------------------------------------------
                     newsubs{j} = subdirs{i};

                  end

               end

               % Replace old directory tree by the new tree stored in newsubs
               % ------------------------------------------------------------
               subdirs = newsubs;
               m = length(subdirs); % To prevent errors when subdirectory-
                                    % change code is called again directly
                                    % after finishing THIS subdir-change.
               disp(' ');
               disp('Current definition of subdirectory tree:');
               disp(' ');
               disp(char(subdirs));
               disp(' ')
               disp(' ');
               disp('<<< Press a key >>>');
               pause

            elseif opt == 3    % Add subdirectories to tree

               ready2 = 0;
               disp(' ');
               while ready2 ~= 1
                  clc
                  disp('Current definition of subdirectory tree:');
                  disp(' ');
                  disp(char(subdirs));
                  disp(' ');
                  disp(' ');
                  disp('Enter name of subdirectory to add (press Enter to return to menu):');
                  disp(' ');

                  % Enter new subdirectory name.
                  % -------------------------
                  newname = input('> ','s');

                  % If new entry is empty, no new directories will be added
                  % to the directory tree anymore.
                  % -------------------------------------------------------
                  if isempty(newname)
                     ready2 = 1;
                  end

                  % Add new directory entry to subdirectory-tree
                  % --------------------------------------------
                  if ready2 ~= 1
                     subdirs{m+1} = newname;
                  end

                  m = length(subdirs); % To prevent errors when subdirectory-
                                       % enhancement code is called again
                                       % directly after finishing THIS
                                       % subdir-enhancement.
               end

            elseif opt == 4    % Ready, current Matlabpath extension should be ok, however
                               % final check will be done by displaying the current path
                               % here and jumping back to the while ready~=1 line.
                               % ---------------------------------------------------------
               clc
               disp('Current FDC path:');
               disp(' ');
               disp('FDC root directory:');
               disp('-------------------');
               disp(rootdir);
               disp(' ');
               disp('FDC subdirectories:');
               disp('-------------------');
               disp(char(subdirs));
               disp(' ');

               ready1 = 1;

            end

         end  % of path-edit options menu loop 

         % Save results to FDC.INI file
         % --------------------------------
         save fdc.ini rootdir subdirs suppress

      elseif answ == 's'

         % The displayed path should now be correct, but checking anyway
         % -------------------------------------------------------------
         if exist(rootdir) ~= 7
            errormsg = ['The specified root-directory does not exist! ', ...
                        'Please check your FDC installation, and re-run FDC.M with ', ...
                        'the correct root-directory.'];
            h = newMsgBox(errormsg,'ERROR');
            uiwait(h);
            clear h errormsg;
            errorflag = 1;

         else

            % Don't change Matlabpath extension, and don't display the "Is this
            % correct?" message anymore in the future.
            % -----------------------------------------------------------------
            disp(' ');
            disp('If you select this option, the current setting for the Matlab-');
            disp('path-extension for the FDC toolbox will be used for _all_');
            disp('future FDC sessions. The path-definition can _only_ be changed');
            disp('with FDCINIT again after deleting the file FDC.INI from');
            disp('the FDC root-directory!');
            disp(' ');
            disp('Are you sure you want to suppress the FDC path-verification');
            disp('for future sessions ([y]/n)?');
            disp(' ');
            answ1 = input('?> ','s');
            if isempty(answ1)
               answ1 = 'y';
            end
            if answ1 == 'y'
               disp(' ');
               disp('So be it...');
               disp(' ');
               disp('<<< Press a key to continue>>>');
               pause

               % Change suppress to 1, to make sure that the directory tree in
               % FDC.INI will be used as Matlabpath extension from now on
               % (every time FDCINIT is started).
               % -------------------------------------------------------------
               suppress = 1;

               % Save results to FDC.INI file
               % ----------------------------
               save fdc.ini rootdir subdirs suppress
            end

            ready = 1;

         end

      else  
         % The displayed path should now be correct, but checking anyway
         % -------------------------------------------------------------
         if exist(rootdir) ~= 7
            errormsg = ['The specified root-directory does not exist. ', ...
                        'Please check your FDC installation, and re-run FDC.M with ', ...
                        'the correct root-directory.'];
            h = newMsgBox(errormsg,'ERROR');
            uiwait(h);
            clear h errormsg;
            errorflag = 1;
         end

         if exist('fdc.ini') == 0

            % Save results to FDC.INI file. This is not necessary if FDC.INI 
            % already exists, since the current setting will be used.
            % --------------------------------------------------------------
            save fdc.ini rootdir subdirs suppress

         end
         
         ready = 1;
         
      end
   end % main path-verification loop
end 


% Add new directories to Matlabpath. Include the FDC root-directory itself 
% only if it doesn't exist already. (If the user follows the installation
% guidelines, the FDC root-directory will be added to the default definition
% of the Matlabpath, while the FDC subdirectories are added by FDCINIT.
% Duplicate names in the Matlabpath will create warning messages, which
% are thus quite likely for the FDC root-directory but not for the sub-
% directories. For this reason, checking FDC subdirectories for duplicate
% names was NOT considered necessary.)
% --------------------------------------------------------------------------
OS = computer;
if strcmp(OS,'PCWIN')
   pos = findstr(lower(matlabpath),lower(rootdir));
else
   pos = findstr(matlabpath,rootdir);
end

m = length(subdirs); % Update, because subdirs may have been changed.
if isempty(pos)
   path(path,rootdir);
end
for i = 1:m
   path(path,fullfile(rootdir,deblank(char(subdirs(i)))));
end

if errorflag ~= 0
    disp(' ');
    delete('fdc.ini');
    error('There were errors. Please verify your FDC root-directory and run FDC again!');
end

%-----------------------------------------------------------------------
% The Flight Dynamics and Control Toolbox version 1.4.0. 
% (c) Copyright Marc Rauw, 1994-2005. Licensed under the Open Software 
% License version 2.1; see COPYING.TXT and LICENSE.TXT for more details.
% Last revision of this file: December 31, 2004. 
%-----------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -