is equivalent 2:2:10 ignoring vector, or have further application?
i wanted created array consisting of multiple numbers [2,3,4,6,8,9,10], surprisingly (2:3):2:10 has returned [2,4,6,8,10].
as answered nick, wrote interpreted matlab
2:2:10 i.e., 3 of first nested sequence ignored.
what think wanted accomplish union of 2 separate sequences:
>> union(2:2:10, 3:3:10) ans = 2 3 4 6 8 9 10 more generally,
n = 100; c = arrayfun(@(x)x+x:x:n, 2:n, 'uniformoutput', false); unique([c{:}])
Comments
Post a Comment