Scale Matrix Dimensions by Factor

조회 수: 4 (최근 30일)
Philip
Philip 2018년 11월 16일
댓글: Philip 2018년 11월 16일
I have a matrix that needs to be scaled in the horizontal, copying each row.
Ex:
[1 2 3]
[4 5 6]
Scale Columns only by Factor 3
[1 1 1 2 2 2 3 3 3]
[4 4 4 5 5 5 6 6 6]
How can I write a simple loop to perform this. Thanks!

채택된 답변

Bruno Luong
Bruno Luong 2018년 11월 16일
>> repelem([1 2 3],3)
ans =
1 1 1 2 2 2 3 3 3
>>
  댓글 수: 4
Bruno Luong
Bruno Luong 2018년 11월 16일
I think I understand now your incorrect MATLAB notation
>> repelem([1 2 3; 4 5 6],1,3)
ans =
1 1 1 2 2 2 3 3 3
4 4 4 5 5 5 6 6 6
>>
Philip
Philip 2018년 11월 16일
Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by