clear all;
u={'High';'M';'LOW'}
y=repelem(u(1:3),2)
% would like the output y=[high;M;LOW;high;M;Low]
I am trying to use repelem but I repeat the element it self n number of times not as I mentioned before
I would like to repeat al the u 2 times with the same sequence
Thanks,

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 4일
편집: Ameer Hamza 2020년 5월 4일

0 개 추천

repmat() is the correct function to use here
u={'High';'M';'LOW'}
y=repmat(u(1:3),2,1)
Result
y =
6×1 cell array
{'High'}
{'M' }
{'LOW' }
{'High'}
{'M' }
{'LOW' }

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Elementary Math에 대해 자세히 알아보기

태그

질문:

2020년 5월 4일

편집:

2020년 5월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by