Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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 Kommentar
Evan
Evan am 9 Jul. 2013
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

John
John am 10 Jul. 2013
Bearbeitet: John am 10 Jul. 2013
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]).

Weitere Antworten (0)

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by