I think `similar` is implemented by optional variable instead of keyword 
variable. But I'm not sure.

Anyway, you can use `eltype(M)` for the second argument.



On Wednesday, August 26, 2015 at 3:37:40 PM UTC+2, harven wrote:
>
> Hi, I have an array and I want to create a similar array with same element 
> type but different dimensions (say, 2x2).
>
>     julia > similar(M, ?, (2,2))
>
> Is there a way to skip the second optional argument, which should be 
> infered from M, and just provide the third?
>
> I have a similar question with images from the Images library. I have an 
> image, and I want to create another image
> with the same properties but different dimension. I came to
>
>        julia > Image(similar(img.data, typeof(img.data[1]), 
> newdimensions), img.properties) 
>
> but there must be a simpler way.
>

Reply via email to