My data is organized in a 3d matrix (subjects x conditions x regions of interest). I've collapsed (averaged) across subjects and conditions so that I'm left with one value for each region of interest using mean(mean(M(:, :, :))). However, I'm trying to find the std and 95% confidence interval (to help with visualization) and I'm not sure if it is statistically sound to use the same logic to calculate the std (i.e. std(std(M(:, :, :))). And, when calculating the 95% CI, which dimension should I use to decide my sample size?