How to choose from a list of strings all the string with specific pattren follows by a digits
Hello,
I use FiledTrip to analyze iEEG data and stack with the following problem.
I try to use the ‘d’ to extract all the channels that start in the letters ‘RHL’ and are followed by any digit, but for some reason, it is not working.
I tried another approach that looked very similar, and I was expected to behave similarly. These is the two approaches:
When I defined depths_LH as:
depths_LH = {‘RHL*’};
I get the desired result. But when I defined depths_LH as
depths_LH = {‘RHLd’};
The code is not working (There is an error, but it seems empty)
This is the entire code:
depths_LH = {‘RHLd’};
reref_depthsLH = {‘RHL1’};
for d = 1:numel(depths_LH)
cfg = [];
cfg.channel = ft_channelselection(depths_LH{d}, data_prepro_ds_tr_ar.label);
disp([‘Selected channels (LH, pattern: ‘, depths_LH{d}, ‘):’]);
disp(cfg.channel); % Print the selected channels for this iteration
cfg.reref = ‘yes’;
cfg.refchannel = reref_depthsLH;
cfg.refmethod = ‘avg’;
cfg.updatesens = ‘yes’;
reref_depthsLH{d} = ft_preprocessing(cfg, data_prepro_ds_tr_ar);
end
Does anyone know what the problem is?
Thank you.Hello,
I use FiledTrip to analyze iEEG data and stack with the following problem.
I try to use the ‘d’ to extract all the channels that start in the letters ‘RHL’ and are followed by any digit, but for some reason, it is not working.
I tried another approach that looked very similar, and I was expected to behave similarly. These is the two approaches:
When I defined depths_LH as:
depths_LH = {‘RHL*’};
I get the desired result. But when I defined depths_LH as
depths_LH = {‘RHLd’};
The code is not working (There is an error, but it seems empty)
This is the entire code:
depths_LH = {‘RHLd’};
reref_depthsLH = {‘RHL1’};
for d = 1:numel(depths_LH)
cfg = [];
cfg.channel = ft_channelselection(depths_LH{d}, data_prepro_ds_tr_ar.label);
disp([‘Selected channels (LH, pattern: ‘, depths_LH{d}, ‘):’]);
disp(cfg.channel); % Print the selected channels for this iteration
cfg.reref = ‘yes’;
cfg.refchannel = reref_depthsLH;
cfg.refmethod = ‘avg’;
cfg.updatesens = ‘yes’;
reref_depthsLH{d} = ft_preprocessing(cfg, data_prepro_ds_tr_ar);
end
Does anyone know what the problem is?
Thank you. Hello,
I use FiledTrip to analyze iEEG data and stack with the following problem.
I try to use the ‘d’ to extract all the channels that start in the letters ‘RHL’ and are followed by any digit, but for some reason, it is not working.
I tried another approach that looked very similar, and I was expected to behave similarly. These is the two approaches:
When I defined depths_LH as:
depths_LH = {‘RHL*’};
I get the desired result. But when I defined depths_LH as
depths_LH = {‘RHLd’};
The code is not working (There is an error, but it seems empty)
This is the entire code:
depths_LH = {‘RHLd’};
reref_depthsLH = {‘RHL1’};
for d = 1:numel(depths_LH)
cfg = [];
cfg.channel = ft_channelselection(depths_LH{d}, data_prepro_ds_tr_ar.label);
disp([‘Selected channels (LH, pattern: ‘, depths_LH{d}, ‘):’]);
disp(cfg.channel); % Print the selected channels for this iteration
cfg.reref = ‘yes’;
cfg.refchannel = reref_depthsLH;
cfg.refmethod = ‘avg’;
cfg.updatesens = ‘yes’;
reref_depthsLH{d} = ft_preprocessing(cfg, data_prepro_ds_tr_ar);
end
Does anyone know what the problem is?
Thank you. strings MATLAB Answers — New Questions