Conditional if statement solution
显示 更早的评论
I will greatly appreciate it if any one assist me in solving this problem in Matlab code
For instance I have a list of values = 3 4 6 3 4 5 10 7 4 5 3 4
The code contains two if statement
if values > 9
in this case it is in position 7 : display the positions in values that meet condition ( if value > 9) in the example above it is the 7th position (10)
then calculate the 5 numbers before and after including position 7th (10) itself an example
average = (4 + 5 + 10 + 7 + 4 )/5 = 6
if (average > 9)
true changes showing ( 7th position = 10 )
else
false changes (7th position = 10 )
end if statement
end if statement
The answer is false change detection
I will like to be assisted with the code as I want to apply these to large data
Thanks in advance
4 个评论
Geoff Hayes
2019-8-15
Tino - what happens if there are more than one element in the array with a value greater than 9? Do you need to apply the same logic to all elements that satisfy this condition?
Tino
2019-8-15
Geoff Hayes
2019-8-15
So you will want to find all elements that are greater than nine and then apply the logic to each one presumably storing the result of each in an array.
Tino
2019-8-15
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!