필터 지우기
필터 지우기

Matrix with 64 Rows and 16 Columns

조회 수: 3 (최근 30일)
Rakesh Yadav Kodari
Rakesh Yadav Kodari 2019년 5월 7일
답변: Star Strider 2019년 5월 7일
Hello Everyone,
I have the a matrix with 16 coloumns.
Each column I have to split as follows
DataA=(1:2:end)
DataB=(2:2:end)
and save these both matrices seperatly.
Can any helpme?

답변 (1개)

Star Strider
Star Strider 2019년 5월 7일
Please see the documentation section on Matrix Indexing (link). You need a second index to address your matrices. What you do depends on the result you want.
Both of these work. One should produce the desired result (assuming ‘M’ is your (64x16) matrix):
DataA = M(:,1:2:end); % Result Is (64x8)
DataB = M(:,2:2:end); % Result Is (64x8)
DataA = M(1:2:end,:); % Result Is (32x16)
DataB = M(2:2:end,:); % Result Is (32x16)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by