필터 지우기
필터 지우기

Import data from .csv files and use them as the input matrixes

조회 수: 1 (최근 30일)
Vasek
Vasek 2012년 3월 23일
Hello everybody,
I have several .csv files(always a file with just one worksheet) containing the input data. What I'd like to do is to take such a file and import certain number of rows (over the all columns, however the number of columns is fixed).
Let say I'd like to receive Matrix1 from "file.csv" with dimension (220 000:265 000, 2:400). Anybody experienced with that? Thank you. Best regards, Vasek

답변 (1개)

William
William 2012년 3월 23일
use the csvread() command
type
help csvread
  댓글 수: 2
Vasek
Vasek 2012년 3월 23일
Hey William, thanks for the answer.
I've tried already csvread before.
a=csvread('Velocity.csv',4,4);
But it returns the following error:
??? Error using ==> dlmread at 145
Number of HeaderColumns is greater than number of columns in file.
Error in ==> csvread at 52
m=dlmread(filename, ',', r, c);
Error in ==> Untitled at 1
a=csvread('Velocity.csv',4,4);
Eric
Eric 2012년 3월 23일
In your question you state that you want to read all columns, yet you're telling the code to skip the first four. You should use
a = csvread('Velocity.csv', 4, 0);
to read in all columns but skip the first four rows.
-Eric

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by