MATLAB Answers

how to delete a digit from an array ???

10 views (last 30 days)
Hello! everyone I have a program in which i have one array of binary numbers and a loop... i wana that if the condition in loop is true then one binary number must be deleted from array... , suppose {
A=[0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 ]
if ( A == 0 & F(i, j)==255)
"then delete 0 from array"
which function should i use to delete a digit from array...plz help me. Thanks in advance

Accepted Answer

Waleed El-Badry
Waleed El-Badry on 5 Jul 2011
Here is another implementation if want to look at the empty half :-)
A=[1 1 1 0 0 0 0 1 1 0];
for i=1:s
if A(i)==0
A(ind)=[]; % removing elements
You have a choice of a being a hardcore developer like me or atomic one like the line of code by Sean :-)
Hope it helps
  1 Comment
Talat on 6 Jul 2011
Thanks both of you guys... it will help me for sure

Sign in to comment.

More Answers (1)

Sean de Wolski
Sean de Wolski on 5 Jul 2011
B = A(~A & F(i,j)~=255)

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!