How would I find the value of a corresponding data set?
4 次查看(过去 30 天)
显示 更早的评论
Say that I have
x=[1;2;5;4;3]
y=[2018;2019;2020;2021;2022]
I know that
[value, index] = max(x) will return
value=5
index=3
But now I want to print the corresponding value of "y" given the index 3. How would I do that using just the variables?
0 个评论
回答(1 个)
the cyclist
2020-1-27
When you say "corresponding", do you mean the 5th
y(value)
or the 3rd?
y(index)
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!