How can I call some line in an excell file ?

조회 수: 1 (최근 30일)
Mallouli Marwa
Mallouli Marwa 2018년 6월 12일
댓글: Mallouli Marwa 2018년 6월 13일
Hello
In a program Matlab I called this excell file but I want the file from line 19
without delating the other lines.
The attached file is the excell file.
Please help me.
  댓글 수: 2
Matt Dickson
Matt Dickson 2018년 6월 12일
You should just be able to
num = xlsread(path/to/file)
since that returns a matrix of the numeric data. You'll just have to manually offset your counter to 19. See more about xlsread here.
Mallouli Marwa
Mallouli Marwa 2018년 6월 12일
I have found this error:
syntax error
And the program is:
cd Z:\
load 'DATA.CSV';
num = xlsread(Z:\/to/DATA.CSV)

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

채택된 답변

Bob Thompson
Bob Thompson 2018년 6월 12일
"I want the file from line 19" -- What does this mean? Is there a file name on line 19? (Sorry but I can't open files on this device to look myself.) Either way you can specify how much of the file you want to read by using offsets or range specification.
rowoffset = 18;
coloffset = 0;
file = csvread(filename,rowoffset,coloffset,[19 0 19 end]);
I'm not sure if end will technically work there for the column range definition, and I'm also fairly sure that you don't want to specify a row offset and start at range 19 (pretty sure that will put you at row 37), but using it as an example of how you can do things.
If you are trying to read some data other than a numeric value you can use a similar range definition in xlsread, as csvread only interprets numeric data.
  댓글 수: 8
Mallouli Marwa
Mallouli Marwa 2018년 6월 13일
No
Bob Thompson
Bob Thompson 2018년 6월 13일
If you only want one value then just set [19 0 19 1] as your range.

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

추가 답변 (1개)

Mallouli Marwa
Mallouli Marwa 2018년 6월 12일
Line 19 contain one numerical data.
  댓글 수: 1
Mallouli Marwa
Mallouli Marwa 2018년 6월 13일
error: called from print_usage at line 91 column 5 csvread at line 39 column 5 Call_Line_Excell at line 7 column 6

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

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by