Filter löschen
Filter löschen

Creating specific matrix from other matrix?

2 Ansichten (letzte 30 Tage)
jack star
jack star am 24 Apr. 2016
Beantwortet: Roger Stafford am 24 Apr. 2016
Hi all. I have data matrix x(1x160) and It's columns contains 0 and 1 values. I want to create a matrix that shows whichs columns are 1.
For example, If x has 1 values on 6-15-20-22-30-90-112-155th columns,
created matrix should be = [6 15 20 22 30 90 112 155]
Do I need for loop for this?

Akzeptierte Antwort

Roger Stafford
Roger Stafford am 24 Apr. 2016
x2 = find(x~=0);

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by