Thanks Matt and Stefan, Your comments are very helpful. I have solved the problem because I use a number to compare an array in line 49. The rand(1) in julia always produces an array rather than a number in Matlab. The types of variables should be used very carefully in Julia.
Isaac On Wednesday, April 23, 2014 10:16:52 PM UTC+2, Isaac wrote: > > > Hi All, > > I am a new Julia-user and meet a problem when I transfer the Matlab code > to Julia. I always get the error:type non-boolean (BitArray(1)) used in > boolean context. Can anyone help me check the code and solve this problem? > The codes have been attached. > I am using the julia-0.3.0-win64 binary release. > Any suggestions and comments would be highly appreciated. > > Cheers, > Isaac > > <http://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCsQFjAA&url=http%3A%2F%2Fforum.wordreference.com%2Fshowthread.php%3Ft%3D2248185%26langid%3D22&ei=Ih9YU4-UJM3JOaCjgKAP&usg=AFQjCNHQ9d3MxWGbJ6kVa5WXzgnDQ1VBRQ&sig2=fFKs_1zFpZD67HrDPpH8Mg> >