Hi everyone,
I have a cell array named B, I want to use all of the cells of it (inside of each cell I have a double matrix, for instance, the first cell is 30800*4 which is the timepoints of 4 channels) so I call it by " sig=B(:,:); " and " sig=B(:,:,:); " but I’ve got an error. I will attach the screenshot. Please let me know my mistake.
From this screenshot it is not clear what shape B is, what the items in B represent, or what the error message is.
Also, in your code it looks like your will be overwriting subs_a1.
It might be easier if you instead copy/paste the code with the code format string (like this), surrounded by the “`” sign (you can also highlight your text and press the button that looks like this </> to do that formatting).
(%% Gathering all subjects in cd=1 EC1 Active
% Load EC1, Active
load B
sig= B(:,:);
cd=1; % cd1= EC1 Active
subs_al= zeros(size(sig));
% Design Filter for alpha
% bandpass butterworth filter
fl= 8;
fh= 12;
order= 3;
wn= [fl fh]/(fs/2);
type= ‘bandpass’;
[b,a]= butter(order,wn,type);
% Apply designed filter
subs_al= filtfilt(b,a,sig)
Also, I think this code is not valid enough to understand the whole code. Needless to mention, you sent me the link (Complex Systems Group at URJC) to do step by step. I exactly want to do these steps but I really got baffled. Would you please guide me or link me with some one who can guide me in details.
I did not define it in my codes, but I have B in the path as a 3D matrix (.mat file) that includes information about each subject in every cell (It is a double matrix).
The third input to filtfilt, which you named sig, must be an array or matrix, where each timeseries you want to filter is represented as a column (unless you decide to only filter one signal at a time, in which case in can be a single row vector).
In the variable explorer (lower left corner of second screenshot), it is not clear what kind of variable sig is; knowing that would help. Also what is the shape of the item inside of B?
You have sig = B(:,:). I imagine that would just set sig equal to B. B looks to be a struct, which is not an accepted format for filtfilt. Is your input signal contained within B?