# Thread: How to remove an entry from an array in MATLAB?

1. ## How to remove an entry from an array in MATLAB?

 I want a code in MATLAB that produces A\{4}, where A={3,6,1,-3,4,8} (i.e. I'd like to get {3,6,1,-3,8}). I know for instance: A=[ 3 6 1 -3 4 8]; A(5)=[]; produces 3 6 1 -3 8 But what should I do if I don't know the index (in this case 5) for the entry '4'; and I want to get [ 3 6 1 -3 8]?

2. ## Re: How to remove an entry from an array in MATLAB?

I have just started using matlab so have that in mind when u read my answer. Here it goes:make a new vector for examlpe t=[A(1:4) A(6)]

...and since ur post dates from 2009, by now u have drop matlab or learn how to use it and u can tell me the answer.

3. ## Re: How to remove an entry from an array in MATLAB?

I have no idea why it says 2009, I posted this about a week or so ago!
But I figured it out. the code can be:

A=[ 3 6 1 -3 4 8];
u=find(A==4);
A(u)=[]

4. ## Re: How to remove an entry from an array in MATLAB?

It doesn't say this was posted in 2009. It says that you first joined this forum in 2009.

,

,

,

### remove entry from array

Click on a term to search for related topics.