How to remove unique columns of a 3D matrix

2 views (last 30 days)
I am trying to build a somewhat large 3D matrix. I'm running into a dimension mismatch at the end of my code when I am removing junk columns and concatenating others.
Here's the code that I'm having trouble with: Some other information, the size of stims is 6 x 189 x 96
blank = [0; 0; 0; 0; numBlank; meanBlank];
white1 = [30; 0; yloc(1,1); xloc(1,1); numWhite1; meanWhite1];
white2 = [30; 0; yloc(1,2); xloc(1,2); numWhite2; meanWhite2];
white3 = [30; 0; yloc(1,3); xloc(1,3); numWhite3; meanWhite3];
black1 = [60; 0; yloc(1,1); xloc(1,1); numBlack1; meanBlack1];
black2 = [60; 0; yloc(1,2); xloc(1,2); numBlack2; meanBlack2];
black3 = [60; 0; yloc(1,3); xloc(1,3); numBlack3; meanBlack3];
% remove the columns that were combined above
delBlank = stims(1,:,ch) == 0;
delFlash = stims(1,:,ch) >= 30;
del = delBlank | delFlash;
stimStrip = stims;
stimStrip(:,del,:) = [];
% concatente the blank and flash vectors to the end of the matrix
stimStrip(:,:,ch) = horzcat(stimStrip(:,:,ch),white1,white2,white3,black1,black2,black3,blank);
% add to data structure to save later
data.stims(:,:,ch) = stimStrip;

Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!