0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 function GNDorGRP=rm_bins(GNDorGRP,bins)
0032
0033 fldnms=fieldnames(GNDorGRP);
0034 isGRP=0;
0035 if ismember('group_desc',fldnms),
0036 isGRP=1;
0037 end
0038
0039 n_bins=length(GNDorGRP.bin_info);
0040 not_have=setdiff(bins,1:n_bins);
0041 if ~isempty(not_have),
0042 watchit(['This GND or GRP variable does NOT have the following bin(s): ' int2str(not_have)]);
0043 end
0044 bins=intersect(bins,1:n_bins);
0045 if isempty(bins),
0046 fprintf('Not removing any bins.\n');
0047 else
0048 fprintf('Removing the following bin(s): %s\n',int2str(bins));
0049
0050
0051 n_ptests=length(GNDorGRP.t_tests);
0052 rm_ptest=[];
0053 for a=1:n_ptests,
0054 if ismember(GNDorGRP.t_tests(a).bin,bins)
0055 rm_ptest=[rm_ptest a];
0056 end
0057 end
0058 if ~isempty(rm_ptest),
0059 fprintf('Removing the following permutation test results because they were performed on bins being deleted: %s\n',int2str(rm_ptest))
0060 end
0061 use_ptests=setdiff(1:n_ptests,rm_ptest);
0062 GNDorGRP.t_tests=GNDorGRP.t_tests(use_ptests);
0063
0064 use_bins=setdiff(1:n_bins,bins);
0065
0066 GNDorGRP.grands=GNDorGRP.grands(:,:,use_bins);
0067 GNDorGRP.grands_stder=GNDorGRP.grands_stder(:,:,use_bins);
0068 GNDorGRP.grands_t=GNDorGRP.grands_t(:,:,use_bins);
0069 GNDorGRP.bin_info=GNDorGRP.bin_info(use_bins);
0070
0071 if isGRP,
0072
0073 n_group=length(GNDorGRP.group_desc);
0074 for a=1:n_group,
0075 GNDorGRP.indiv_bin_ct{a}=GNDorGRP.indiv_bin_ct{a}(:,use_bins);
0076 GNDorGRP.indiv_bin_raw_ct{a}=GNDorGRP.indiv_bin_raw_ct{a}(:,use_bins);
0077 end
0078 else
0079
0080 GNDorGRP.sub_ct=GNDorGRP.sub_ct(use_bins);
0081 GNDorGRP.indiv_bin_ct=GNDorGRP.indiv_bin_ct(:,use_bins);
0082 GNDorGRP.indiv_bin_raw_ct=GNDorGRP.indiv_bin_raw_ct(:,use_bins);
0083 GNDorGRP.indiv_erps=GNDorGRP.indiv_erps(:,:,use_bins,:);
0084 end
0085 end