Eliminating unnecessary portions of arrays from structure.

2 ビュー (過去 30 日間)
bio lim
bio lim 2015 年 6 月 19 日
コメント済み: bio lim 2015 年 6 月 21 日
Hello. I have 1x1574 structure array called "data" with 27 fields. I would like to perform on one of the fields, "IAS". I would like to only extract (take out) the near constant segment, and eliminate the rest. For example.
plot(data(1).Altitude, data(1).IAS)
I get the following graph.
I only want to take out the near constant segment, which is around 300 knots. (Range around plus and minus 10 knots) (From 2.4 * 10^4 to 3.2 * 10^4). When I extract this, I also want this to happen to the other fields.(In other words, I am only interested in the near constant segments of the IAS, and the others are not important).
Now I can do this one by one, but the problem is I have 1574 arrays which is too many. Could anyone help me? Thanks!
  1 件のコメント
James Tursa
James Tursa 2015 年 6 月 19 日
編集済み: James Tursa 2015 年 6 月 19 日
To clarify, are you trying to do something like this pseudo-code?
for k=1:1574
range = find indexes for the beginning near-constant portion of data(k).IAS
f = fieldnames(data(k));
n = numel(f);
for m=1:n
Remove range from data(k).(f{m});
end
end

サインインしてコメントする。

採用された回答

Fabio Freschi
Fabio Freschi 2015 年 6 月 19 日
編集済み: Fabio Freschi 2015 年 6 月 19 日
If I understand correctly you want something like this
idx = find(data(1).IAS >= 290 & data(1).IAS <= 310);
plot(data(1).Altitude(idx), data(1).IAS(idx));
Then you can use 'idx' to extract the desired values from other fields
data(1).something(idx)
Actually you can also use logical indexing removing 'find'.
Fabio
  1 件のコメント
bio lim
bio lim 2015 年 6 月 21 日
This only works if you want only 290<IAS<310 for all arrays, which is not in my case.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by