MATLAB Answers

Select data from CSV file based on character in position, then read that character and next 2 character, of different read that character and next 3

5 views (last 30 days)
Douglas Courtney
Douglas Courtney on 23 Nov 2020
Answered: Steve Eddins on 23 Nov 2020
Hi,
Sorry its probably very easilily sorted but im only just starting with mathlab and I am unsure how to do this.
So, I have a CSV file of data i am trying to capture certain elements, Flow rate/Time.
The flow rates change from 1.XX to 0.1XX. So for the 1.XX there are a total of 3 values i need to capture and for 0.1XX there are 4.
If i had 1.XX take 4 characters then it would return 1.XX; as it would include the comma thatdelineates the data in the CSV.
I already have the Time by capturing the first 19 characters,
I can capture the flow rate by selecting characters 21-26 but some of these obviously contain the ; which i dont want.
Again apologies its probably very easy to somoone who knows what they are doing
Thanks

  0 Comments

Sign in to comment.

Answers (1)

Steve Eddins
Steve Eddins on 23 Nov 2020
MATLAB has a number of functions that can automatically read and parse CSV files and return the results in a useful form. Try readtable, readtimetable, readmatrix, and readcell.

  0 Comments

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!