Importing Matrix from text or csv files
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a large matrix that I'd like to import, preferably in one command into a few different Matlab variables. I have been attempting to use "importdata" but it doesn't seem to respect the row headers because many of them are numeric (CUSIPS). I have a file that's roughly 1000x500 with one row of column headers and one column of row headers. Does anyone know how I can import this data all at once? If not all at once, what's the easiest way to go about importing it all when I'm not quite sure how many columns I will have in total? In the end I should have two arrays of column headrers (text) and a matrix of numerical data.
Thanks a lot, Brian
0 commentaires
Réponse acceptée
the cyclist
le 21 Fév 2012
Personally, I like the readtext() function from the FEX for mixed-type files: http://www.mathworks.com/matlabcentral/fileexchange/10946.
This is not to be confused with the MATLAB function textread(), whose help file has the quote "If the file contains any text data, an error is produced." :-)
4 commentaires
the cyclist
le 21 Mar 2012
I think you should launch a new question on this, and add more detail around what the text that you are importing looks like (possibly with an example).
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Import and Export dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!