How to filter two columns of a table in MATLAB, determine the average and count the data in the columns
2 ビュー (過去 30 日間)
古いコメントを表示
I would like to filter for Vehtype = 650 and their respective Travel Time (Trav). After which, I would like to extract all the filter data and determine the average Travel Time (Trav.) for this vehicle type. I would also like to count the number of vehicles under this vehicle type (Vehtype = 650).
1 件のコメント
Dyuman Joshi
2023 年 3 月 23 日
What have you tried yet? Please show your code.
And please attach your code using the paperclip button, so it is easy for us to provide suggestions or solutions.
採用された回答
Cris LaPierre
2023 年 3 月 23 日
編集済み: Cris LaPierre
2023 年 3 月 28 日
Use groupsummary
If you have shared your data instead of a screenshot, we could test the settings, but you probably want something like this.
mnTbl = groupsummary(Tbl,"Vehtype","mean","Trav")
This will give you the groupcount and mean travel time for each vehicle type. From there, you can extract the info for the specific vehicle type you are interested in. See the Access Data in Tables page for more on how to do that.
その他の回答 (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!