A simple allocation of array places to zero does not work in MATLAB R2020B
3 次查看(过去 30 天)
显示 更早的评论
I have a numeric array KSE
I have identified a number of locations where there are peaks,
locations =
Columns 1 through 10
147 827 3772 4762 5192 5618 6048 6481 6915 7350
Columns 11 through 20
7781 8206 8637 9070 9502 9938 10367 10793 11225 11657
Columns 21 through 26
12922 13876 20315 23377 24431 25492
I have identified in that array a number of locations where there are short lived transients, a number of which I wish to remove.
Those unwanted transients are identified by
ii =
1 2 3 21 22 23 24 25 26
The command
KSE(locations(ii)-50:locations(ii)+50)=0
is meant to replace 50 array elements on either side of the transient location with a zero.
It works well at the first location but not in the remaining 8 locations!
Is this a bug or am I doing some sort of stupid coding mistake?
Any soultions would be appreciated!
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!