How do I repeat different numbers in a row?
Show older comments
I need to find a more concise way of repeating different numbers, each a different number of times in a row.
My current row (1x45 matrix) contains 15 8 times, 4 10 times, 5 8 times, 12 6 times, 4 6 times, 5 3 times and 12 4 times
i.e. my current matrix looks like:
A = [15 15 15 15 15 15 15 15 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 12 12 12 12 12 12 4 4 4 4 4 4 5 5 5 12 12 12 12]
Is there a more concise way I can code this data to produce this matrix?
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!