Hey everyone,

I have a vector of vectors, `x`

, and a vector of scalars, `x_proposed`

. Both have the same number of elements:

```
x = [ [.3, .4, .3 ], [.5, .4, .1], 1., 2., [3., 4.] ]
x_proposed = [ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14.]
```

Now I would like to resize `x_proposed`

such that it has the same form of `x`

. I managed to build a function that does (almost) the job:

```
function resize(θ, θ_proposed)
result = eltype(θ)[]
counter = 1
len = length.(θ)
for i in eachindex(len)
push!(result, ( θ_proposed[(counter):(counter+len[i]-1)] ) )
counter += len[i]
end
result
end
#Works but has only vectors at each index
test = resize(x, x_proposed)
```

The problem here is that now all elements `test`

are vectors itself, even the singletons. **Question:** Is there somehow a fast way that I can do this? This sounds like a super trivial question, but I have struggled to complete it and also not found any answers in Google. The main problem is that

```
θ_proposed[(counter):(counter+len[i]-1)]
```

will always show a range and thus an array is initialized…

**Edit:**

I can make an intermediate function:

```
function make_scalar(x)
length(x) > 1 ? x : x[1]
end
```

which basically does what I want to do in the double loop section here:

`make_scalar( invlink(distribution[2][1], θ_proposed_reshaped[4] ) )`

However, I really do think there might be faster, and definitely cleaner ways to handle this?