How do I import .csv file into MATLAB that has multiple values per field? MATLAB is not importing this properly.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
So I have a .csv file, that has 14 rows and 120 columns. I need to import this .csv file into MATLAB. Now the problem is that there are 128 values per each field in this .csv file, all of which has to be imported properly (I'm attaching picture of how the data looks here below, you can see there are multiple values per field). I tried importing it as a .csv but it doesn't give me any of these values. I also tried converting to .txt and importing that, but it doesn't give all the values either. Is there any way I could import this data properly into MATLAB?

2 comentarios
Stephen23
el 16 de Nov. de 2020
@Zuha Yousuf : please upload a sample file by clicking on the paperclip button.
Respuestas (1)
Walter Roberson
el 10 de Nov. de 2020
S = fileread('YourFileNameHere.csv');
S = regexrep(S, {'\[|\]', '\s+'}, {'', ','});
data = cell2mat(textscan(S, '')); %format '' tells it to figure out number of columns
2 comentarios
Ver también
Categorías
Más información sobre Whos en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!