Best function for opening up .csv files as a matrix?

조회 수: 1 (최근 30일)
Darren Kenney
Darren Kenney 2017년 6월 2일
편집: per isakson 2017년 6월 2일
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,

채택된 답변

Star Strider
Star Strider 2017년 6월 2일
Add 'CollectOutput',true to import them as one array:
a = fopen('filename.csv');
b = textscan(a, '%s %s %s %s', 'delimiter', ',', 'CollectOutput',true);

추가 답변 (1개)

Stephen23
Stephen23 2017년 6월 2일

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by