remove a column from multi-dimensional array on MATLAB

Viewed 78

I have a (n x m x l) array on MATLAB, and I want to remove 'k' columns (on 2nd-dimension). Finally, it may be a (n x (m - k) x l) size.

There is a constraints which is 'n' is fixed. Because MATLAB does not support assign null to array with more than two specific indexes when using colon indexing, I have no idea how can I do this.

Here is my sample code.

channel = 32;
trial = 75;
time = 2000;
data = MyCustomData(...);
disp(data); % ans = [32 75 2000]

for ch = 1:channel
    rejected_trials = []
    for trial = 1:trial
        if(is_rejected_trial(data(ch, trial, :))
            rejected_trials(end + 1) = trial;
        end
    end
    data(ch, rejected_trials, :) = []; % This line makes error
end

How can I reject some trials on multi-dimensional array with specific indexes?

0 Answers
Related