Retrieving numbers present within an array by knowing the coordinates
1 次查看(过去 30 天)
显示 更早的评论
Hi! I have a fairly easy question but whose error I can't figure out.
I have the array "image_DEF_number_pixel" and the coordinates (x,y) in "union". I would like to create a vector containing the values present in "image_DEF_number_pixels" based on the coordinate (x,y) present in "union".
For example:
--> line 129 of "union" has coordinates (202, 188)
--> the value I want to get in a new vector is 186 because at coordinate (202, 188) inside "image_DEF_number_pixel" there is number 186.
Here is the line of code I am using:
image_DEF_numero_pixel = importdata('image_DEF_numero_pixel.mat');
union = importdata('union.mat');
vector = image_DEF_numero_pixel(union);
0 个评论
采纳的回答
更多回答(1 个)
Torsten
2023-2-14
image_DEF_numero_pixel = importdata('image_DEF_numero_pixel.mat')
union = importdata('union.mat')
vector = arrayfun(@(x,y)image_DEF_numero_pixel(x,y),union(1:size(union,1),1),union(1:size(union,1),2))
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 3-D Scene Control 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!