ERROR: LoadError: syntax: function argument names not unique

I am receiving this weird error.

The code is:

function absInt(array)
newarray = array
for n = 1 : length(array)
if array[n] < 0
array[n] = -array[n]
end
end
return newarray
end

function CloneBinRepresentation(Nmut)

# Number of clones
Nclones = 2^Nmut

# Initialize empty arrays:
# StringRep will contain Nclones strings (2^Nmut in binary)
# BinRep will set each element to be 0,1
# e.g. StringRep[i] = '00111' is binary representation of 7.
# BinRep[i,:] = [0;0;1;1;1] to be used in manipulation to make Q matrix
StringRep = Array{String}(undef,Nclones)
BinRep = Array{Int64}(undef,Nclones,Nmut)

# This loop creates the arrays
for i = 0 : Nclones-1
    StringRep[i+1] = string(i,base=2,pad=Nmut)
    for j = 1 : Nmut
        BinRep[i+1,j] = parse(Int64,StringRep[i+1][j])
    end
end

# We only need the BinRep, but string is given for error checking
return BinRep,StringRep

end

function Qmatrix(Nmut,mutRate)

Nclones = 2^Nmut

# (BinRep,StringRep) = CloneBinRepresentation(Nmut)

Q = zeros(Nclones,Nclones)

for i = 1 : Nclones
    count = 0;
    for j = 1: Nclones
    temp = BinRep(j,:) - BinRep(i,:);
        if sum(temp) == 1 && sum(absInt(temp)) == 1
        Q(i,j) = mutRate;
        count = count + 1;
        end
    end
    Q(i,i) = 1 - count*mutRate;
end

return Q

end

Q = Qmatrix(3,0.01)

Which returns the error:
ERROR: LoadError: syntax: function argument names not unique

These are not array indexing, rather function definition syntax in julia. You need to fix all the matlab syntax you have.

2 Likes