1

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 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

3 Comments

Fantastic. Thank you for your help!
@itend Accept the answer if this works for you, just so others know :) stackoverflow.com/help/someone-answers
Will do. I'm new to this platform :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.