필터 지우기
필터 지우기

Loading a excel file in which I want to take only B, D not C , how can it be done?

조회 수: 2 (최근 30일)
Hi,
I have a question regarding reading in the data from Excel. I have to import the data as a combination of two columns, e.g. column A and C, column B and D.
But if I use the xlsread function, I can only read in the data as a combination of two columns being next to each other, e.g. A and B, or B and C.
Your help is appreciated.
Thanks, Julia
  댓글 수: 1
Evan
Evan 2013년 7월 9일
I am also interested in whether or not this is possible without multiple xlsread calls, so I'm commenting here so I can follow this thread.

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

채택된 답변

John
John 2013년 7월 10일
편집: John 2013년 7월 10일
The best way to do this is call xlsread() once (read in all the data) and index the data you need:
data = xlsread('test.xlsx');
AC = data(:, [1 3]);
BD = data(:, [2 4]);
data(:, [1 3]) means take all rows (:) and columns 1 and 3 ([1 3]).
  댓글 수: 1
Julia
Julia 2013년 7월 10일
John, you just saved me hours of work!!!!! It solves my problem, many thanks!!!

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

추가 답변 (0개)

카테고리

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