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:
delete arrays

Subject: delete arrays

From: Jonathan

Date: 16 Dec, 2008 03:25:04

Message: 1 of 3

I have an array 296*1, that contains matrices of various dimensions (column numbers are constant, but variable number of rows). What I would like to do is eliminate those matrices that do not exceed a particular matrix size (e.g. those matrices that have numbers of rows less than say 4). Any ideas on how to do this?

Thanks
Jon

Subject: delete arrays

From: us

Date: 16 Dec, 2008 05:18:02

Message: 2 of 3

"Jonathan"
> I have an array 296*1, that contains matrices of various dimensions (column numbers are constant, but variable number of rows). What I would like to do is eliminate those matrices that do not exceed a particular matrix size (e.g. those matrices that have numbers of rows less than say 4)...

one of the solutions

% the data
     c(1:5,1)={magic(3)};
     c(3,1)={magic(10)};
     d=c;
% the engine
     ix=cellfun(@(x) size(x,1)<4,c);
     d(ix)=[];
% the result
     disp(c);
     disp(d);

us

Subject: delete arrays

From: Jonathan

Date: 16 Dec, 2008 19:00:22

Message: 3 of 3

"us " <us@neurol.unizh.ch> wrote in message <gi7dma$7g1$1@fred.mathworks.com>...
> "Jonathan"
> > I have an array 296*1, that contains matrices of various dimensions (column numbers are constant, but variable number of rows). What I would like to do is eliminate those matrices that do not exceed a particular matrix size (e.g. those matrices that have numbers of rows less than say 4)...
>
> one of the solutions
>
> % the data
> c(1:5,1)={magic(3)};
> c(3,1)={magic(10)};
> d=c;
> % the engine
> ix=cellfun(@(x) size(x,1)<4,c);
> d(ix)=[];
> % the result
> disp(c);
> disp(d);
>
> us

Thanks, this resolved my problem.

Tags for 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