Importing only a fraction of a database using dataset

1 次查看(过去 30 天)
I have a large dataset in csv format (400MB). How can I import in MatLab only the first 500 rows?
  1 个评论
Sebastiano delre
Sebastiano delre 2016-5-14
Actually csvread does not work for me because my data contain not only numerical variables. I have also strings and cells. Is there a way I can use the function dataset?

请先登录,再进行评论。

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-5-14
nc=6; % Number of column in your csv file
nr=500
data=csvread('file.csv',0,0,[0 0 nr-1 nc-1])
  4 个评论
Walter Roberson
Walter Roberson 2016-5-14
xlsread() accepts range arguments.
You have R2013b according to your other postings; you could consider readtable() . I do not know how fast that would be; I seem to remember later releases made it faster.
Sebastiano delre
Sebastiano delre 2016-5-15
Actually I have R2014b now. readtable() works fine and it is very very fast. Thanks!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by