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 cell element from a big cell array

Subject: delete cell element from a big cell array

From: Eleftheria Paidousi

Date: 12 Dec, 2012 00:08:16

Message: 1 of 4

I had a matrix with mixed data in csv of 45212*17 dimensions

i used textscan and created a cell array D{1,m}(n,1)
i want to delete some elements but when i try

 for i=1:45212
if (D{1,13}(i,1)>1)
for j=1:17
D(1,j)(i,1)=[]
end
end
end
Error: ()-indexing must appear last in an index expression.
what's the problem?!
what should i do?!

Subject: delete cell element from a big cell array

From: bartekltg

Date: 12 Dec, 2012 03:22:12

Message: 2 of 4

W dniu 2012-12-12 01:08, Eleftheria Paidousi pisze:
> I had a matrix with mixed data in csv of 45212*17 dimensions
> i used textscan and created a cell array D{1,m}(n,1)
> i want to delete some elements but when i try
>
> for i=1:45212
> if (D{1,13}(i,1)>1)
> for j=1:17
> D(1,j)(i,1)=[]

Wrong brackets.

D{1,j}(i,1)=[];

But this doesn't work either.

You can't cut out one element from matrix. Only whole row or column.

A = ones (2);
A(1,1)=[]; % "Subscripted assignment dimension mismatch."

[ 1]
[1 1]

is not matrix;)



bartekltg

Subject: delete cell element from a big cell array

From: Eleftheria Paidousi

Date: 13 Dec, 2012 15:58:07

Message: 3 of 4

so i can't delete an element from a cell only?!
>

Subject: delete cell element from a big cell array

From: dpb

Date: 13 Dec, 2012 18:27:53

Message: 4 of 4

On 12/13/2012 9:58 AM, Eleftheria Paidousi wrote:
> so i can't delete an element from a cell only?!
>>

A cell is a container for another object--if that object is an array,
that array must be regular. You could have a cell contain a 1D vector
and each cell can then be of different lengths but not a matrix or array
w/ different numbers of elements per row or column (or plane or other
higher dimension).

It's not clear precisely what your object is; I thought from an earlier
posting you were trying to remove all of some variable--that certainly
can be done but if it is indeed just hit 'n miss points/values here and
there you'll have to deal with it some other way--such as assigning a
NaN as indicator of missing value or somesuch.

--

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