1
votes

I have a cell array named "output"(dimension = 3 x 6). Each cell in the first row of this cell array has entries which are 1024 x 1024 matrices (type double). I would like to take the mean value of a given ROI within each matrix. For example, I would want Matlab to produce the mean of the region ([100:200],[100:200]) for each of the matrices and save to an excel or .txt.

I am unsure how to proceed in terms of coding this. Please help!

Thanks :)

1

1 Answers

1
votes

You can use cellfun to compute a mean over an ROI for each cell in the first row like so:

meanValues = cellfun(@(m) mean(mean(m(100:200, 100:200))), output(1, :));

Then you can save this to a file using either xlswrite (Excel file), csvwrite (comma-separated text file), or dlmwrite (delimiter-separated text file).