How do I import .csv file into MATLAB that has multiple values per field? MATLAB is not importing this properly.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Stephen23
am 16 Nov. 2020
@Zuha Yousuf : please upload a sample file by clicking on the paperclip button.
Antworten (1)
Walter Roberson
am 10 Nov. 2020
S = fileread('YourFileNameHere.csv');
S = regexrep(S, {'\[|\]', '\s+'}, {'', ','});
data = cell2mat(textscan(S, '')); %format '' tells it to figure out number of columns
2 Kommentare
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!