Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
select the opposite of what the index specifies

Subject: select the opposite of what the index specifies

From: Patrick Diviacco

Date: 30 Nov, 2009 11:31:19

Message: 1 of 5

hi,

how can I ask matlab to index all rows of my matrix that do not match with 1:30:end ?

projData(4:30:end,:)

In other terms, I want all rows except row 4, 34, 64.. etc

thanks

Subject: select the opposite of what the index specifies

From: wapo

Date: 30 Nov, 2009 11:48:57

Message: 2 of 5

On Nov 30, 12:31 pm, "Patrick Diviacco" <patrick.divia...@gmail.com>
wrote:
> hi,
>
> how can I ask matlab to index all rows of my matrix that do not match with 1:30:end ?
>
> projData(4:30:end,:)
>
> In other terms, I want all rows except row 4, 34, 64.. etc
>
> thanks

ind=1:length(projData)
setdiff(ind,4:30:length(projData))

length(projData) needs some more thinking but that's basically the
path to go

Subject: select the opposite of what the index specifies

From: DitzaN

Date: 30 Nov, 2009 12:13:36

Message: 3 of 5

Try this:

FullIdx=1:end;
NotIdx=4:30:end;
Idx=setdiff(FullIdx,NotIdx)

replace the "end" with the length of yours vector

Subject: select the opposite of what the index specifies

From: Patrick Diviacco

Date: 30 Nov, 2009 12:50:19

Message: 4 of 5

thanks for answers, anyway I found another solution.. I think it is ok:

  target_test = images(1:30:end,:);
    other_test = images;
    other_test(1:30:end,:) = [];



DitzaN <ditzaspam@gmail.com> wrote in message <1118997206.56832.1259583246260.JavaMail.root@gallium.mathforum.org>...
> Try this:
>
> FullIdx=1:end;
> NotIdx=4:30:end;
> Idx=setdiff(FullIdx,NotIdx)
>
> replace the "end" with the length of yours vector

Subject: select the opposite of what the index specifies

From: Hossein

Date: 7 Mar, 2013 09:05:08

Message: 5 of 5


D(1:end ~= i)

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us