Scale Matrix Dimensions by Factor
8 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
Bruno Luong
2018-11-16
>> repelem([1 2 3],3)
ans =
1 1 1 2 2 2 3 3 3
>>
4 个评论
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
>>
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!