How to find corresponding x values for array of y values
7 次查看(过去 30 天)
显示 更早的评论
Hello,
I have imported data from an image processing software where I have a series of stacked x-y coordinates (from a stacked image). My raw data consists of one column of x-values and over 400 columns of y-values. In MatLab, I currently am able to produce a1x465 array with each minimum value of y from each y column. How can I find the cooresponding x-value for each min value of y?
0 个评论
采纳的回答
Cris LaPierre
2021-2-18
编辑:Cris LaPierre
2021-2-18
Use the following syntax
When you are taking the min of an mxn array, I is a vector containnig the row numbers of the minimum values. Use that to index into your column of X values.
x = [3;10];
[MN,I] = min(rand(2,3))
x(I)
更多回答(1 个)
David Hill
2021-2-18
Assuming the first column is x and the remaining columns y of matrix M
[min,idx]=min(M(:,2:end));
x=M(idx,1);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!