I've also noticed this.  Let's say a = 1, ix = [1].  So a[ix] gives an
error while a[1] and a[a] do not give errors.  In Matlab, there is no
difference between the type of a and ix, while in other languages there
is.    In Matlab a([1]) doesn't produce an error, while in Julia a[[1]]
does.

I'm not certain if this is just something that we have to live with, or if
there is some other solution.

chris


On Fri, May 15, 2015 at 2:22 PM, Jeff Waller <truth...@gmail.com> wrote:

> Well I think the problem here is that though M[:,1]' * M[:,1] has only 1
> value, it's still a (1x1) matrix, and not a scalar.
> What happens when you change to this?
>
> a=(M[:,1]' * M[:,1])[1]
>
> related.  is automatically converting a 1x1 matrix to a scalar or defining
> comparison between 1x1 matrices and scalars reasonable?
>
>
> On Friday, May 15, 2015 at 5:14:43 PM UTC-4, Lytu wrote:
>>
>> When i do:
>> M=rand(5,5)
>> a=M[:,1]' * M[:,1]
>> if a<0
>> println("Less than 0")
>> else
>> println("more")
>> end
>>
>> I have an error: " isless has no method matching
>> isless(::Array{Float64,2}, ::Int 32) in < at operators.jl:32
>>
>> Can anyone tell me please how to do this? Thank you
>>
>


-- 
chris.p...@ieee.org

Reply via email to