Find values in array by meshgrid coordinate and assign to correct row in table without for loop
Show older comments
Hi, I have the the following variables attached below.
XY is a table where each row has a X and Y coordinate of a meshgrid. I would like to take those coordinates and take the corresponding ImRef value at that coordinate and put in the XY.int column.
XY.int already contains the values I want to obtain from ImRef. I did this using a for loop but it takes extremely long and I hope there is a quicker method.
I have tried ismember but it doesn't retain the correct sequence to append it into my table.
Current (slow) approach:
for x = 1:1:height(XY)
XY.int(x) = ImRef(XY.xy(x)==xymesh);
end
EDIT: Added matlab.mat containing the other files I mentioned.
Thanks.
2 Comments
What is IMREF? Your data does not contain it:
S = load('XY.mat')
T = S.XY
Maximilian Rowe
on 6 Mar 2025
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!