How can extract values from array?

2 Ansichten (letzte 30 Tage)
Aseel H
Aseel H am 13 Sep. 2011
I have an array as X = [0 0 1 3;5 0 2 1;-1 0 1 7;0 1 8 3]; I wante extract the values that are 0's and 1's by the same order of them in X in other array such as Y = [0 0 1 0 1 0 1 0 1]
please reply for my question
thanks

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 13 Sep. 2011
x1 = X'
x1 = x1(:)'
out = x1(x1 == 0 | x1 == 1)

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by