Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: delete column with known col indices
Date: Sat, 13 Jun 2009 07:39:01 +0000 (UTC)
Organization: Boeing
Lines: 22
Message-ID: <h0vl2l$3h0$1@fred.mathworks.com>
References: <h0vf59$nk3$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1244878741 3616 172.30.248.37 (13 Jun 2009 07:39:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 13 Jun 2009 07:39:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 756104
Xref: news.mathworks.com comp.soft-sys.matlab:547129


"Diego Lass" <dlISCool@gmail.com> wrote in message <h0vf59$nk3$1@fred.mathworks.com>...
> Hi
> I want to delete several columns in a matrix and get the resulting matrix without using loops, what is the fastest way to do this. I saw some posts but didn't understand them.
> 
> For example
> 1 2 3 4 5
> 6 7 8 9 10
> 
> I want to delete columns [1 3] and get
> 2 4 5
> 7 9 10
> 
> what is the fastest way to do this.
> 
> Thanks
> Diego 

A = [1 2 3 4 5;6 7 8 9 10]
C = [1 3]
A(:,C) = []

James Tursa