📄 rtc_concatenate.m
字号:
function hfile3 = rtc_Concatenate(hfile, hfile2, combine)
% RTC::Concatenate - concatenate RTCs
%
% FORMAT: crtc = rtc1.Concatenate(rtc2 [, combine]);
%
% Input fields:
%
% rtc2 second RTC
% combine if given and evaluates to true only concatenate in Y
% otherwise blocked
%
% Output fields:
%
% crtc combined/concatenated RTC
% Version: v0.7b
% Build: 7090213
% Date: Sep-02 2007, 1:34 PM CEST
% Author: Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools
% argument check
if nargin < 2 || ...
numel(hfile) ~= 1 || ...
numel(hfile2) ~= 1 || ...
~isBVQXfile(hfile, 'rtc') || ...
~isBVQXfile(hfile2, 'rtc')
error( ...
'BVQXfile:BadArgument', ...
'Invalid call to %s.', ...
mfilename ...
);
end
bc1 = bvqxfile_getcont(hfile.L);
bc2 = bvqxfile_getcont(hfile2.L);
if nargin > 2 && ...
numel(combine) == 1 && ...
(islogical(combine) || isnumeric(combine))
if combine
combine = true;
else
combine = false;
end
else
combine = false;
end
% check type and sizes of RTCs
if ~strcmpi(bc1.Type, 'designmatrix') || ...
~strcmpi(bc2.Type, 'designmatrix')
error( ...
'BVQXfile:TypeNotSupported', ...
'This RTC type is currently not supported for beta calculation.' ...
);
end
% get RTC matrices
rtc1 = bc1.RTCMatrix;
rtc2 = bc2.RTCMatrix;
% combine or block
if combine
if size(rtc1, 2) ~= size(rtc2, 2)
error( ...
'BVQXfile:InternalError', ...
'Combine impossible. Different number of predictors in RTCs.' ...
);
end
% combine
rtc = [rtc1;rtc2];
else
% block
rtc = [ ...
[rtc1, zeros(size(rtc1, 1), size(rtc2, 2))]; ...
[zeros(size(rtc2, 1), size(rtc1, 2)), rtc2]];
% get names lists
pnam1 = bc1.PredictorNames(:)';
pnam2 = bc2.PredictorNames(:)';
onam2 = pnam2;
% put names of list2 into list1
for p2c = 1:length(pnam2)
% name exists?
nnc = 1;
while any(strcmp(pnam2{p2c}, pnam1))
% build new name
nnc = nnc + 1;
pnam2{p2c} = sprintf('%s - S%d', onam2{p2c}, nnc);
end
% put name into list
pnam1{end + 1} = pnam2{p2c};
end
end
% put into new RTC
hfile3 = BVQXfile('new:rtc');
bc3 = bvqxfile_getcont(hfile3.L);
bc3.NrOfPredictors = size(rtc, 2);
bc3.NrOfDataPoints = size(rtc, 1);
bc3.PredictorNames = pnam1(:)';
bc3.RTCMatrix = rtc;
bvqxfile_setcont(hfile3.L, bc3);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -