Scale Matrix Dimensions by Factor
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Philip
am 16 Nov. 2018
Kommentiert: Philip
am 16 Nov. 2018
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 Kommentare
Akzeptierte Antwort
Bruno Luong
am 16 Nov. 2018
>> repelem([1 2 3],3)
ans =
1 1 1 2 2 2 3 3 3
>>
4 Kommentare
Bruno Luong
am 16 Nov. 2018
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
>>
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!