Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How can i import both text and numeric data via Data import
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Tim
el 23 de Jun. de 2015
Editada: Tim
el 23 de Jun. de 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 comentarios
La pregunta está cerrada.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!