How can I which value that be used to calculate a function
1 次查看(过去 30 天)
显示 更早的评论
In this casue, I difine a range for x and y, and then calculated the min value of L, but how do i find which x vaule and y value to calculate the min L? Many thanks!!!!!

0 个评论
采纳的回答
Fangjun Jiang
2019-5-14
编辑:Fangjun Jiang
2019-5-14
You need to run min() twice
A=magic(5);
[MinInCol,RowIndex]=min(A);
[MinValue,ColIndex]=min(MinInCol);
Position=[RowIndex(ColIndex),ColIndex];
or better
[MinValue,Index]=min(A(:));
[Ix,Iy]=ind2sub(size(A),Index)
2 个评论
Fangjun Jiang
2019-5-17
Not clear what you mean. Maybe in your example, you are looking for x(Ix), y(Iy)?
更多回答(1 个)
Steven Lord
2019-5-14
Since you indicate that you're using release R2019a, call min with the 'linear' option and two output arguments. This will give you the linear index of the minimum value, and you can use that index into x and y.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!