フィルターのクリア

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

2 ビュー (過去 30 日間)
Julia
Julia 2013 年 7 月 9 日
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 Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by