how to read surrounding matrix elements following list of coordinates

Version 1.0.0.0 (657 Bytes) by John BG
how to read surrounding matrix elements following list of coordinates answer to reddit.com question
25 Downloads
Updated 4 Apr 2016

View License

answer to reddit.com matlab question
https://www.reddit.com/r/matlab/comments/4d1r6y/is_it_possible_to_convert_mutliple_local_regions
Q:
For example, if I have a 10×10 matrix, and I have a list of n coordinates in that matrix, I would like to take a 3×3 region surrounding each coordinate, resize it to be a length 9 vector, and then stack all the vectors into a 9×n matrix. I know I could write a for loop to do this but that seems gross, though probably what I'll end up doing.

Cite As

John BG (2024). how to read surrounding matrix elements following list of coordinates (https://www.mathworks.com/matlabcentral/fileexchange/56345-how-to-read-surrounding-matrix-elements-following-list-of-coordinates), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Matrices and Arrays in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0