How to find values from data

5 次查看(过去 30 天)
Zach Hanses
Zach Hanses 2021-12-12
评论: Zach Hanses 2021-12-12
When using if statements, I am trying to find a set of data that fits the condition I have given. How can I find where the data with the right conditions is located?

回答(1 个)

KSSV
KSSV 2021-12-12
You can use logical indexing.
Example:
A = rand(10,1) ; % data for demo
idx = A > 0.3 & A < 0.8 ;
idx
idx = 10×1 logical array
0 1 0 1 0 0 0 0 0 0
find(idx)
ans = 2×1
2 4
A(idx)
ans = 2×1
0.7124 0.7594
  5 个评论
Star Strider
Star Strider 2021-12-12
What are the row and column sizes are the two data sets? Do they have common times (or any other specific identifying row information)?
Zach Hanses
Zach Hanses 2021-12-12
they are both 244x1. Each row is supposed to indicate days

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Elementary Math 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by