Effacer les filtres
Effacer les filtres

Importing only a fraction of a database using dataset

1 vue (au cours des 30 derniers jours)
Sebastiano delre
Sebastiano delre le 14 Mai 2016
I have a large dataset in csv format (400MB). How can I import in MatLab only the first 500 rows?
  1 commentaire
Sebastiano delre
Sebastiano delre le 14 Mai 2016
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?

Connectez-vous pour commenter.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 14 Mai 2016
nc=6; % Number of column in your csv file
nr=500
data=csvread('file.csv',0,0,[0 0 nr-1 nc-1])
  4 commentaires
Walter Roberson
Walter Roberson le 14 Mai 2016
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 le 15 Mai 2016
Actually I have R2014b now. readtable() works fine and it is very very fast. Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by