Best function for opening up .csv files as a matrix?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Darren Kenney
am 2 Jun. 2017
Bearbeitet: per isakson
am 2 Jun. 2017
I'm using matlab 2012 and the function:
a = fopen('filename.csv');
b = textscan(a, '%s %s %s %s', 'delimiter', ',')
But the resulting matrix is a 1x4 cell with 101x1 matrixes inside of them. I was hoping for a 101x4 matrix since that would be easier to work with. Does the 2012 version of matlab not have a function for this?
All the best,
1 Kommentar
Akzeptierte Antwort
Star Strider
am 2 Jun. 2017
Add 'CollectOutput',true to import them as one array:
a = fopen('filename.csv');
b = textscan(a, '%s %s %s %s', 'delimiter', ',', 'CollectOutput',true);
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Logical 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!