Find value in an NxMxP array and return index
1 次查看(过去 30 天)
显示 更早的评论
I have an N x M x P array. Its filled with all possible values of a parameter. I'm looking for the value closest to a target I have. I need to find that value and the index of said value.
I've played around with these functions but they don't work the way I want them.
[C, I] = min(min(min(abs(theta-targettheta))));
thetafound=abs(targettheta-C);
this only return the p index not the n or m
[C, I]=min(abs(theta-targettheta),[],3);
this isn't returning just 1 result or the array even.
Any ideas?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!