MATLAB Answers

How to get specific columns from a csv file and get its average and standard deviation?

4 views (last 30 days)
Sabaz Ahmed Mazumder
Sabaz Ahmed Mazumder on 30 Apr 2021
Commented: Rik on 30 Apr 2021
Here i have a csv file attached. From this file in the first column there is VehicleID, for eg one vehicleID is Auto_102 corresponding to that there is column that is Speed now i need to get Average speed of all the VehilcleID (note that the ID are different so we need to use string comparison to find the avg of same vehicleID) and standard deviation from the csv file. How do i do it ?

Answers (1)

Rik on 30 Apr 2021
Often the answer to 'how to do this' is: break your problem into solvable steps.
You need to read your data from a file to a Matlab variable. Were you able to do that?
You need to find all unique IDs, loop over them and find all occurences of a given ID. Did you try unique, a for loop, and ismember?
You want to find the average and the standard deviation. Did you try a google search or guess a plausible name for functions that might calculate that?


Community Treasure Hunt

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

Start Hunting!