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

📄 eeg_toolbox_recent.m

📁 Matlab下的EEG处理程序库
💻 M
字号:
function [files,p] = eeg_toolbox_recent(filename,command);
% EEG_TOOLBOX_RECENT - Keep track of eeg_toolbox .mat files
%
% Useage:   [files,p] = eeg_toolbox_recent([filename],[command])
%
%           filename = path & filename of saved .mat file
%           command  = 'load', to load filename
%                      'clear', to clear all recent files
%
%           If filename is not given, the function returns
%           the most recent files saved (if any).  If it 
%           is given, the filename is added to the list.
%
%           If the load command is given, filename.mat is
%           loaded and the p struct is returned.  Otherwise
%           the p struct is empty.
%           
%           Tracks recent p structure saves to .mat files
%           for the eeg_toolbox gui.  The return variable
%           'files' is a cell array of strings containing
%           the filesystem location of recent p files saved.
%
%           The recent files list is currently limited to 10.
%

% $Revision: 1.2 $ $Date: 2003/03/02 03:20:43 $

% Licence:  GNU GPL, no express or implied warranties
% Created:  02/2002 Darren.Weber@flinders.edu.au
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% try to locate the installation path
path = fileparts(which('eeg_toolbox_recent'));
if isempty(path),
    msg = sprintf('Cannot find eeg_toolbox on the matlab path.\n\nPlease use the addpath command.\n\n');
    error(msg);
else
    path = strcat(path,filesep);
end

% default location for recent file list
recentfile = strcat(path,'eeg_toolbox_recent.mat');
files = cell(1);

fid = fopen(recentfile,'r');
if ~isequal(fid,-1),
    fclose(fid);
    load(recentfile);
end

if ~exist('filename','var'), filename = ''; end

limit = 20;

if ~isempty(filename),    
    if isempty(files{1}),
        files{1} = filename;
    else
        % should check to see if already in list
        % if so, just rearrange the list
        i = strmatch(filename,char(files),'exact');
        if ~isempty(i),
            % remove it from current list
            if isequal(i,1),         files = files(2:end);
            elseif isequal(i,limit), files = files(1:end-1);
            else                     files = files([1:i-1 i+1:end]);
            end
        end
        files = fliplr(files);   % put most recent at end, for now
        files{end+1} = filename; % add filename to end
        files = fliplr(files);   % now put most recent at beginning
        if size(files,2) > limit,
            files = files(1:limit); % only keep 'limit' most recent
        end
    end
    save(recentfile,'files');
end

p = [];
if ~exist('command','var'), command = ''; end

switch command,
case 'load',
    if ~isempty(filename), load(filename); end
case 'clear',
    files = cell(1);
    save(recentfile,'files');
otherwise,
end

return

⌨️ 快捷键说明

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