Info
This question is closed. Reopen it to edit or answer.
Load csv with date-time column and other colums with numbers and changing date-time to number.
1 view (last 30 days)
Show older comments
Hello, I have csv file of stock data that has around 5000 rows and looks like this:
timestamp,open,high,low,close,volume 2017-11-03,5.7000,5.9400,5.6300,5.7500,822395 2017-11-02,5.6100,5.8100,5.5500,5.7800,1120941 2017-11-01,5.4600,5.6300,5.4400,5.6200,717112
Now I would like to load it into matrix, but timestamps i would like to change to some number and then i would like to be able to easily transform this number back to timestamp.
0 Comments
Answers (1)
KL
on 21 Nov 2017
Edited: KL
on 21 Nov 2017
If you have 2013b or later use readtable,
data = readtable('filename.csv');
your first column will have datetime format by default (if your data is properly formatted), you can modify a specific row by
data.timestamp(your_row) = some other date here
then you use writetable if you want to export the updated data to csv
writetable(data,'filename.csv');
0 Comments
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!