Selecting specific columns to import from a CSV
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Stanley Kubrick
il 12 Feb 2015
Risposto: sathish kumar rb
il 11 Nov 2017
The data I import from my GPS is formatted as CSV files with the following headers:
ID, Session_ID, Heading, Altitude, Latitude, Longitude, Created_DateTime
I only need the Latitude and Longitude values in columns 5 and 6. Is there any way of achieving this?
Currently I delete the last column manually in excel (Created_DateTime) and then use:
data = csvread('gps.csv',1,4);
This returns my latitude/longitude data but I'm wondering if there is a way of doing this without having to manually delete the Created_DateTime column in excel?
0 Commenti
Risposta accettata
dpb
il 12 Feb 2015
fmt=[repmat('%*f',1,4) repmat('%f',1,2) '%*[^\n]'];
fid=fopen('gps.csv');
data=cell2mat(textscan(fid,fmt,'collectoutput',1));
fid=fclose(fid);
See
doc textscan % for details...
3 Commenti
Più risposte (1)
sathish kumar rb
il 11 Nov 2017
hi need to select a specific colomns and rows copy one to another csv file how
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Import and Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!