matsel.m
来自「含有多种ICA算法的eeglab工具箱」· M 代码 · 共 141 行
M
141 行
% matsel() - select rows, columns, and epochs from given multi-epoch data matrix%% Usage:% >> [dataout] = matsel(data,frames,framelist);% >> [dataout] = matsel(data,frames,framelist,chanlist);% >> [dataout] = matsel(data,frames,framelist,chanlist,epochlist);%% Inputs:% data - input data matrix (chans,frames*epochs) % frames - frames (data columns) per epoch (0 -> frames*epochs)% framelist - list of frames per epoch to select (0 -> 1:frames)% chanlist - list of chans to select (0 -> 1:chans)% epochlist - list of epochs to select (0 -> 1:epochs)%% Note: The size of dataout is (length(chanlist), length(framelist)*length(epochlist))%% Author: Scott Makeig, SCCN/INC/UCSD, La Jolla, 5-21-96 %123456789012345678901234567890123456789012345678901234567890123456789012% Copyright (C) 5-21-96 Scott Makeig, SCCN/INC/UCSD, scott@sccn.ucsd.edu%% This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2 of the License, or% (at your option) any later version.%% This program 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.%% You should have received a copy of the GNU General Public License% along with this program; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA% $Log: matsel.m,v $% Revision 1.1 2002/04/05 17:36:45 jorn% Initial revision%% 5-25-96 added chanlist, epochlist -sm% 10-05-97 added out of bounds tests for chanlist and framelist -sm% 02-04-00 truncate to epochs*frames if necessary -sm% 01-25-02 reformated help & license -ad function [dataout] = matsel(data,frames,framelist,chanlist,epochlist)if nargin<1 help matsel returnendif isempty(data) fprintf('matsel(): empty data matrix!?\n') returnend[chans framestot] = size(data);if chans<1 help matsel returnendif nargin < 5, epochlist = 0;endif nargin < 4, chanlist = 0;endif nargin < 3, fprintf('matsel(): needs at least 3 arguments.\n\n'); returnendif frames == 0, frames = framestot;endif framelist == 0, framelist = [1:frames];endframesout = length(framelist);if isempty(chanlist) | chanlist == 0, chanlist = [1:chans];endchansout = length(chanlist);epochs = floor(framestot/frames);if epochs*frames ~= framestot fprintf(... 'matsel(): data length %d was not a multiple of %d frames.\n',... framestot,frames); data = data(:,1:epochs*frames);endif isempty(epochlist) | epochlist == 0, epochlist = [1:epochs];endepochsout = length(epochlist);if max(epochlist)>epochs fprintf('matsel(): max index in epochlist (%d) > epochs in data (%d)\n',... max(epochlist),epochs); returnendif max(framelist)>frames fprintf('matsel(): max index in framelist (%d) > frames per epoch (%d)\n',... max(framelist),frames); returnend if min(framelist)<1 fprintf('matsel(): framelist min (%d) < 1\n',... min(framelist)); returnend if max(chanlist)>chans fprintf('matsel(): chanlist max (%d) > chans (%d)\n',... max(chanlist),chans); returnend if min(chanlist)<1 fprintf('matsel(): chanlist min (%d) <1\n',... min(chanlist)); returnend dataout = zeros(chansout,framesout*epochsout);for e=1:epochsout dataout(:,framesout*(e-1)+1:framesout*e) = ... data(chanlist,framelist+(epochlist(e)-1)*frames); end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?