tebleにフィルターをかけるには
Show older comments
##やりたいこと
MatlabでCSVを取り込み、データセットに分けて解析をしたいと思っていますが、
データセットに分けるところで苦戦をしています。
具体的には以下のような操作を考えています。
db =
date color name field number
______ ______ ____ ___ __
2016/10/13 グリーン tanaka 1号 3.4848
2016/10/17 グリーン tanaka 1号 17.576
2016/10/22 グリーン tanaka 2号 14.697
2016/10/25 グリーン tanaka 2号 28.939
2016/10/29 グリーン tanaka 2号 56.818
.....(略)
fieldlst = [1号, 2号, 3号.....]
while fieldlst(i)
sample = 「field == fieldlst(i)となるような行だけを抽出したもの」
.....分析処理......
i = i+1
↑上記"sample"の作り方がわかりません。
##試したこと
公式ドキュメントのtableは参照しましたが、該当ページを見つけることができませんでした。
*公式ドキュメント
https://jp.mathworks.com/help/matlab/tables.html?s_tid=CRUX_lftnav
##補足情報(FW/ツールのバージョンなど)
R2019 使用
Accepted Answer
More Answers (1)
Yoshio
on 2 Jun 2019
1 vote
こちらが参考になるかと思います。
これを踏まえた上で、以下のようなやり方では、いかがでしょうか。
fieldlst = [1号, 2号, 3号.....]
for i = 1:length(fieldlst)
j = find(db.field == fieldlst(i)) % dbでfieldlst(i)に該当する 行を見つける(複数)
for k = 1:length(j)
sample = db(j(k),:) % ここでは該当する一行毎の処理を想定
.....分析処理......
end % of k
end % of i
dbのデータを作っていないので、間違いがあるかも知れません。
次回ご質問際は、簡単に検証できるようなダミーコード(今回ですとdbの生成コード)を入れていただけると助かります。
ご参考まで。
1 Comment
chihiro kanada
on 2 Jun 2019
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!