📄 fdcinit.m
字号:
% change code is called again directly
% after finishing THIS subdir-change.
disp(' ');
disp('Current definition of subfolder tree:');
disp(' ');
disp(subdirs);
disp(' ')
disp(' ');
disp('<<< Press a key >>>');
pause
elseif opt == 3 % Add subfolders to tree
ready1 = 0;
disp(' ');
while ready1 ~= 1
clc
disp('Current definition of subfolder tree:');
disp(' ');
disp(subdirs);
disp(' ');
disp(' ');
disp('Enter name of subfolder to add');
disp('[<= 8 characters, enter = ready!]:');
disp(' ');
% Enter new subfolder name.
% -------------------------
newname = input('> ','s');
% If new entry is empty, no new folders will be added to
% the folder tree anymore.
% ------------------------------------------------------
if isempty(newname)
ready1 = 1;
end
% Check length of the subfolder to make sure that the
% folder name is not longer than eight characters, or to
% add spaces to folder name if it is shorter than eight
% characters.
% ------------------------------------------------------
L = length(newname);
if L > 8
error('Filename must be shorter than 9 characters!');
elseif L < 8 & L > 0
for ii = 1:(8-L) % add spaces to newsub to get sub-
% folder name of 8 characters.
% -------------------------------
newname = [newname ' '];
end
end
% Add new folder entry to tree, stored in subdirs.
% ------------------------------------------------
if ready1 ~= 1
subdirs = [subdirs; newname];
end
[m,n] = size(subdirs); % To prevent errors when subfolder-
% enhancement code is called again
% directly after finishing THIS
% subdir-enhancement.
end
elseif opt == 4 % Ready, current Matlabpath extension is ok.
% ------------------------------------------
disp(' ');
disp(' ');
% Last check of the Matlabpath extension...
% -----------------------------------------
disp('Current Matlabpath-extension for the FDC toolbox:');
disp(' ');
disp(['FDC Root folder: ', rootdir]);
disp(' ');
disp(['FDC Subfolders: ', subdirs(1,:)]);
[m,n] = size(subdirs);
for i = 2:m
disp([' ', subdirs(i,:)]);
end
disp(' ');
answ3 = input('Path ok ([y]/n)? ','s');
if isempty(answ3)
answ3 = 'y';
end
if answ3 == 'y'
% Now we finally know for sure that tree is correct...
% ----------------------------------------------------
ready = 1;
end
end
end % of while-loop (loop is left if ready = 1).
% Save results to FDCINIT.INI file.
% ---------------------------------
save fdcinit.ini rootdir subdirs suppress
elseif answ == 's'
% The displayed path should now be correct, but checking anyway
% -------------------------------------------------------------
if exist(rootdir) ~= 7
h = errordlg('Specified root-directory does not exist! Check installation, and re-run FDC.M - the results are not correct!');
uiwait(h);
clear h
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 future');
disp('sessions. The path-definition can only be changed with FDCINIT');
disp('again after deleting the file FDCINIT.INI from the FDC root-');
disp('folder!');
disp(' ');
disp('So: 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 >>>');
pause
% Change suppress to 1, to make sure that the folder tree in
% FDCINIT.INI will be used as Matlabpath extension from now on
% (every time FDCINIT is started).
% ------------------------------------------------------------
suppress = 1;
% Save results to FDCINIT.INI file.
% ---------------------------------
save fdcinit.ini rootdir subdirs suppress
end
end
else % Current path setting is correct... but checking anyway!
if exist(rootdir) ~= 7
h = errordlg('Specified root-directory does not exist! Check installation, and re-run FDC.M - the results are not correct!');
uiwait(h);
clear h
errorflag = 1;
end
if exist('fdcinit.ini') == 0
% Save results to FDCINIT.INI file. This is not necessary if
% FDCINIT.INI already exists, since the current setting will
% be used.
% ----------------------------------------------------------
save fdcinit.ini rootdir subdirs suppress
end
end
end
% Add new folders to Matlabpath. Include the FDC root-folder itself only
% if it doesn't exist already. (If the user follows the installation
% guidelines, the FDC root-folder will be added to the default definition
% of the Matlabpath, while the FDC subfolders are added by FDCINIT.
% Duplicate names in the Matlabpath will create warning messages, which
% are thus quite likely for the FDC root-folder but not for the subfolders.
% For this reason, checking FDC subfolders for duplicate names was NOT
% considered necessary.)
% -------------------------------------------------------------------------
if computer=='PCWIN',
pos = findstr(lower(matlabpath),lower(rootdir));
else
pos = findstr(matlabpath,rootdir);
end
[m,n] = size(subdirs); % Update, because subdirs may be changed.
if isempty(pos)
path(path,rootdir);
end
for i = 1:m
path(path,fullfile(rootdir,deblank(subdirs(i,:))));
end
if errorflag == 0
fdc_strt;
else
disp(' ');
delete('fdcinit.ini');
error('There were errors. Check your FDC root-folder and run FDC again! ');
end
% Clear all unwanted variables.
% -----------------------------
clear pathext pathtmp n m answ answ1 answ2 answ3 i ii rootdir subdirs
clear newsubs newname suppress opt ready ready1 L errorflag
% -----------------------------------------------------------------------------
% The FDC toolbox. Copyright Marc Rauw, 1994-2000.
% Last revision of this program: June 12, 2000. (SR2 fix)
%
% Revision history since September 31, 1997
% =========================================
% September 31, 1997
% - Added initialization of the variable pathtmp for Matlab 5 compatibility
% October 5, 1997
% - Changed keyboard input routines to prevent Matlab 5 warnings about
% (possibly) empty string variables
% October 7, 1997
% - Changed terminology: 'directory' is now called 'folder' (except for the
% variables 'subdirs', which was maintained for compatibility reasons)
% - Generalized the code to improve portability of the code to non-Windows
% versions of Matlab
% October 10, 1997
% - Editorial changes; show new on-line help-instructions after initializing
% - Included root-folder check after user specifies that path is correct
% - Discouraged path-changes for new users
% October 12, 1997
% - Created graphically more appealing welcome message (see FDC_WELC.M)
% - Created menu which guides the user to FDCLIB and on-line help-texts after
% initializing the toolbox (see FDC_STRT.M)
% February 7, 1998
% - FDCINIT does not show folder-structure anymore if the user has selected
% the 'Suppress' option during an earlier FDC session
% - Choosing the option 'S' (suppress) during the folder-check will now produce
% an error message if the root-folder is not correct i.s.o. accept the wrong
% entry
% - FDC root-folder is not added to the Matlabpath anymore if it already exists
% in the default Matlabpath definition
% - Several editorial changes
% June 15, 1998
% - Added path-comment for SR1 version of FDC 1.3
% June 12, 2000
% - Editorial change to prevent path problems when upper-case characters are
% applied in directory names
% - New path extension commands allow the use of spaces within directory-names
% (but other FDC files have not yet been updated, so it doesn't work yet!)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -