필터 지우기
필터 지우기

array manipulation such as [ 1 2 5 7 3 .... ] --> [ 1 1 1 ... 2 2 2 ... 5 5 5 ... 7 7 7 ... 3 3 3 ... .... ].

조회 수: 1 (최근 30일)
JK
JK 2017년 9월 17일
답변: Jan 2017년 9월 17일
Using
A = [ 1 2 5 7 3 .... ],
I would like to create
B = [ 1 1 1 ... 2 2 2 ... 5 5 5 ... 7 7 7 ... 3 3 3 ... .... ]
Can you please show me a way to do that? Thanks.

채택된 답변

Jan
Jan 2017년 9월 17일

추가 답변 (1개)

michio
michio 2017년 9월 17일
A = [ 1 2 5 7 3];
tmp = repmat(A,[3,1]);
B = tmp(:)';

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by