table2arrayで条件に合う変数だけを呼び出す方法
Show older comments
csvfile<-readtable('csvfile.csv')
for n=1:3
VarX=table2array(csvfile((csvfile.name == name{n}), ★★));
end
添付した16行×3列のcsvファイルを読み込み(変数はname, id, profit)、各nameの値(5つの観測値)ごとにid==1(実際はidは1,2,3,4,5まである)を満たすprofitのみを取り出して別のtableにしたいのですが、↑の★★の部分にどのようなコードを書けばよいでしょうか。実際にやりたいものはn=25なのでループの基本形はこのまま維持したいです。
Accepted Answer
More Answers (0)
Categories
Find more on table 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!