Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
How can i import both text and numeric data via Data import
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Currently i import the numeric data via the matlab Import data -> select colums -> Matrix. However i need to use the text data from the same while but none of the option help as this just asks me to replace the text data. The data comes from a csv file with a large name so we like to keep the import like that instead of via code.
A small snippet from the data:
;Chipset;HDD;CPU1;MEM1;
43445653;0.01;0.01;0.01;0.00;
43445654;0.02;0.01;0.01;0.01;
43445655;0.03;0.02;0.02;0.01;
43445656;0.04;0.02;0.03;0.02;
I need to use the text chipset, hdd etc in the code but i can't seem to find a way to import both of them as they just replace the text data with NaN. Any suggestions?
0 commentaires
Réponses (1)
Tim
le 23 Juin 2015
Modifié(e) : Tim
le 23 Juin 2015
fid = fopen('file.csv','r');
C = textscan(fid, repmat('%s',1,10), 'delimiter',';', 'CollectOutput',true);
C = C{1};
fclose(fid);
Also xlsread works on csv's:
[num txt raw] = xlsread(Filename, worksheet);
will put the numerical data in num, text data in text and all of it in a cell array "raw".
0 commentaires
Cette question est clôturée.
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!