I'm new in Matlab and I'm trying to create a new vector out of the elements of another vector with the condition that the elements should not be contained by another vector. To be more clear I'll give an example:
I have 2 vectors v=[1,2,3,4,5,6] and w=[3,4] . I want to create a vector u, w made by the elements of v and without the elements of w; ex u=[1,2,5,6].
I looked for a function but I couldn't find it. Please can someone tell me how to do this.
|
|
0
|
|
|
|
Reply
|
mee
|
6/16/2010 2:10:08 PM |
|
On Wed, 16 Jun 2010 14:10:08 +0000, mee gestaf wrote:
> example: I have 2 vectors v=[1,2,3,4,5,6] and w=[3,4] . I want to create
> a vector u, w made by the elements of v and without the elements of w;
> ex u=[1,2,5,6]. I looked for a function but I couldn't find it. Please
> can someone tell me how to do this.
see help diff
|
|
0
|
|
|
|
Reply
|
utab
|
6/16/2010 2:12:04 PM
|
|
utab <utabak@tudelft.nl> wrote in message <b1015$4c18dbb4$82a112b1$11192@news1.tudelft.nl>...
> On Wed, 16 Jun 2010 14:10:08 +0000, mee gestaf wrote:
>
>
> > example: I have 2 vectors v=[1,2,3,4,5,6] and w=[3,4] . I want to create
> > a vector u, w made by the elements of v and without the elements of w;
> > ex u=[1,2,5,6]. I looked for a function but I couldn't find it. Please
> > can someone tell me how to do this.
>
> see help diff
10x for the riply, but I can't see how this could help me. It says that for
Y = diff(X) calculates differences between adjacent elements of X.
If X is a vector, then diff(X) returns a vector, one element shorter than X, of differences between adjacent elements:
|
|
0
|
|
|
|
Reply
|
mee
|
6/16/2010 2:26:05 PM
|
|
utab <utabak@tudelft.nl> wrote in message <b1015$4c18dbb4$82a112b1$11192@news1.tudelft.nl>...
> On Wed, 16 Jun 2010 14:10:08 +0000, mee gestaf wrote:
>
>
> > example: I have 2 vectors v=[1,2,3,4,5,6] and w=[3,4] . I want to create
> > a vector u, w made by the elements of v and without the elements of w;
> > ex u=[1,2,5,6]. I looked for a function but I couldn't find it. Please
> > can someone tell me how to do this.
>
> see help diff
10x for the riply, but I can't see how this could help me. It says that for
Y = diff(X) calculates differences between adjacent elements of X.
If X is a vector, then diff(X) returns a vector, one element shorter than X, of differences between adjacent elements:
|
|
0
|
|
|
|
Reply
|
mee
|
6/16/2010 2:26:05 PM
|
|
utab wrote:
> On Wed, 16 Jun 2010 14:10:08 +0000, mee gestaf wrote:
>
>
>> example: I have 2 vectors v=[1,2,3,4,5,6] and w=[3,4] . I want to create
>> a vector u, w made by the elements of v and without the elements of w;
>> ex u=[1,2,5,6]. I looked for a function but I couldn't find it. Please
>> can someone tell me how to do this.
>
> see help diff
that would be
doc setdiff % (diff() is 1st-order differences within vector)
and friends...
--
|
|
0
|
|
|
|
Reply
|
dpb
|
6/16/2010 2:26:57 PM
|
|
setdiff(v,u)
|
|
0
|
|
|
|
Reply
|
Matt
|
6/16/2010 2:30:26 PM
|
|
On Wed, 16 Jun 2010 09:26:57 -0500, dpb wrote:
>
> doc setdiff % (diff() is 1st-order differences within vector)
of course, my humble apologies :)
|
|
0
|
|
|
|
Reply
|
utab
|
6/16/2010 2:35:01 PM
|
|
> doc setdiff % (diff() is 1st-order differences within vector)
>
> and friends...
>
> --
thank you, that is what I need it.
|
|
0
|
|
|
|
Reply
|
mee
|
6/16/2010 2:42:04 PM
|
|
|
7 Replies
278 Views
(page loaded in 0.049 seconds)
Similiar Articles: Create a vector out of other two vectors - comp.soft-sys.matlab ...I'm new in Matlab and I'm trying to create a new vector out of the elements of another vector with the condition that the elements should not be cont... combining two vectors - comp.soft-sys.matlabCreate a vector out of other two vectors - comp.soft-sys.matlab ... combining two vectors - comp.soft-sys.matlab I know that to build this function, I must first arrange ... Assigning value to symbolic expressions in vector - comp.soft-sys ...Create a vector out of other two vectors - comp.soft-sys.matlab ... Assigning value to symbolic expressions in vector - comp.soft-sys ... Other than that... hmmm, let me ... Magnitude of a 3d vector - comp.dspCreate a vector out of other two vectors - comp.soft-sys.matlab ... Magnitude of a 3d vector - comp.dsp... 3D y*0.5; /* hoist out the =93/2 ... where I threw half a ... fast angle calculation between 2D vectors - comp.soft-sys.matlab ...... grid points, there's a 2 dimensional vector. I ... here, but had to find out ... calculation between 2D vectors - comp.soft-sys ... Q: How to Fade 2 images into each other ... emacs lisp tutorial: list & vectors - comp.emacsThese are similar to other language's list, vector, array. =E2=94=81=E2=94=81=E2 ... 94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81 Vectors To create a vector ... Vector/Matrix Multiplication - comp.soft-sys.matlab... En = [e(1,n) e(2,n) e(3,n)] I want to create a set of matrices by multiplying these vectors with ... Maybe someone else out there ... available, but all the other ... intersect two vectors - comp.soft-sys.matlabThe two vectors intersect with each other at different places. How do I f... ... is the per-product calculation. There are two vectors, v1 and v2. Create a third vector ... find unique row vectors of a matrix - comp.soft-sys.matlab ...> Write back if you can't figure it out. Hmmm. I had ... combine matrices - comp.soft-sys.matlab merging two vectors ... say I have a Nx3 matrix with random values and a vector x. How to suppress template specialization? - comp.lang.c++.moderated ...I need to use bool type of vectors in in a code based ... only access, so using data() (as I stressed out in ... needs a pointer to an array of T, you can create a vector of T ... Create a vector out of other two vectors - comp.soft-sys.matlab ...I'm new in Matlab and I'm trying to create a new vector out of the elements of another vector with the condition that the elements should not be cont... Finding the span of two vectors? - Yahoo! AnswersDining Out; Education ... but the span of these 3 vector is only a plane because the third is a linear combination of the other two. Had these 3 vectors ... 7/29/2012 10:46:51 PM
|