Hopefully basic Matlab question

Soldato
Joined
29 Oct 2004
Posts
10,884
I've got a vector at the moment, let's call it X; it's full of logical values, say:

Code:
X = [1 0 0 0 1 0 0 1 0];

Where each 1 appears, I need to replace it with two elements, [1 0], so the vector becomes:

Code:
X = [1 0 0 0 0 1 0 0 0 1 0 0];

I've tried doing it as shown below, but Matlab isn't having any of it.

Code:
X(X==1) = [1 0];


Firstly is this possible; secondly, if it is, would anyone be helpful enough to tell me how, or at least point me in the right direction?

Any help appreciated

Cheers!
 
Back
Top Bottom