Info

此问题已关闭。 请重新打开它进行编辑或回答。

Load csv with date-time column and other colums with numbers and changing date-time to number.

1 次查看(过去 30 天)
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.

回答(1 个)

KL
KL 2017-11-21
编辑:KL 2017-11-21
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');

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by