Just the sum of 1 to n
t = sum(1:n)
Test  Status  Code Input and Output 

1  Pass 
n = 1;
t = 1;
assert(isequal(triangle(n),t))
sum =
0
sum =
1

2  Pass 
n = 3;
t = 6;
assert(isequal(triangle(n),t))
sum =
0
sum =
1
sum =
3
sum =
6

3  Pass 
n = 5;
t = 15;
assert(isequal(triangle(n),t))
sum =
0
sum =
1
sum =
3
sum =
6
sum =
10
sum =
15

4  Pass 
n = 30;
t = 465;
assert(isequal(triangle(n),t))
sum =
0
sum =
1
sum =
3
sum =
6
sum =
10
sum =
15
sum =
21
sum =
28
sum =
36
sum =
45
sum =
55
sum =
66
sum =
78
sum =
91
sum =
105
sum =
120
sum =
136
sum =
153
sum =
171
sum =
190
sum =
210
sum =
231
sum =
253
sum =
276
sum =
300
sum =
325
sum =
351
sum =
378
sum =
406
sum =
435
sum =
465

1813 Solvers
210 Solvers
341 Solvers
215 Solvers
Matlab Basics  Convert a row vector to a column vector
349 Solvers