Creating specific matrix from other matrix?

조회 수: 1 (최근 30일)
jack star
jack star 2016년 4월 24일
답변: Roger Stafford 2016년 4월 24일
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?

채택된 답변

Roger Stafford
Roger Stafford 2016년 4월 24일
x2 = find(x~=0);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by