I have a 70x70x328 matrix and want to take the mean along either the first or second dimension (they're the same) while ignoring elements that are 0. I'm getting the error: ()-indexing must appear last in an index expression but don't know how to rearrange or what to add to my expression. Here's what I have
for i=1:length(files) Mean1(:,i)=mean(All_files(:,:,i)(All_files(:,:,i)~=0),2);end
Thanks!
Best Answer