Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

arranging a matrix data

조회 수: 1 (최근 30일)
shailesh khaire
shailesh khaire 2013년 3월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
i have matrix A (12x1) as ---
A =
6
5
3
4
8
4
6
7
5
2
3
6
8
9
8
I want to write a code such that matrix Ao will be again (12x1) but its (1st, 4th, 7th , 10th,13th), (2nd, 5th, 8th,11th, 14th) and (3rd, 6th, 9th, 12th, 15 th) will get together. e.g. Ao =
6
4
6
2
8
5
8
7
3
9
3
4
5
6
8

답변 (2개)

Vishal Rane
Vishal Rane 2013년 3월 28일
There will offcourse be a smarter way to do this, but to get you started:
Ao = [];
Interval = 3;
for i = 1 : Interval
Ao = [Ao ; A(i:Interval:end)];
end
here 3 is the interval you need.

Andrei Bobrov
Andrei Bobrov 2013년 3월 28일
Ao = reshape(reshape(A,3,[])',[],1);

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by