Expression

Hi Chris,

Is there a ‘matlab’ way to do this in mworks:

var curridx = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5]

matlab way would be:

var cuuidx = [zeros(5,1) 1ones(5,1) 2ones(5,1)…and so on]

I need to create a variable curridx that goes till 11 instead of 5. So, 11 reps of each integer from 0 to 11 in one array.

Thanks!


Sujay

Hi Sujay,

Not really. With the currently nightly build, you could use

[0]*5 + [1]*5 + [2]*5 + [3]*5 + [4]*5 + [5]*5

but I think that’s as close as you can get with a single expression.

Chris