Asked by Mohammad Golam Kibria
on 12 Dec 2012

I have two array a=[1,2,3] and b=[2,3,4,5]

I need a array c=b\a. Here \ is the set subtract operation. result is as follows:

i.e.c=[4,5]

How to do that in matlab. Thanks in advance.

*No products are associated with this question.*

Answer by Vishal Rane
on 12 Dec 2012

Use

c = b(~ismember(b,a))

although there might be more simpler way to do this.

Opportunities for recent engineering grads.

## 0 Comments