Use square brackets [] for indexing an Array

If I call a function, I get the following errors:

Bspln = Bspline(p,knot,t[it])

MethodError: objects of type Array{Float64,2} are not callable
Use square brackets for indexing an Array.

Stacktrace:
[1] Bspline(::Int64, ::Array{Float64,2}, ::Float64) at ./In[2]:13
[2] top-level scope at ./In[6]:16

function Bspline(p,knot,t)

nb=size(knot,2)-p-1
Bspln=zeros(nb,p+1)

for ip=0:p
for i=1:(nb-ip)
Bspln[i,ip+1]=0
end
end

return (Bspln)
end

p=3
knot=[-1 -1 -1 -1 0 1 1 1 1]
knot=[knot ones(1,p)]
nb=size(knot,2)-p-1
ndt=10 # t steps
t1=minimum(knot)
t2=maximum(knot)
t=t1:(t2-t1)/ndt:t2
nt=size(t,1)
y=zeros(nb,p+1,nt)
for it=1:nt
Bspln = Bspline(p,knot,t[it])
end

Please quote your code and a provide a self-contained example.

function Bspline(p,knot,t)

nb=size(knot,2)-p-1
Bspln=zeros(nb,p+1)

for ip=0:p
for i=1:(nb-ip)
Bspln[i,ip+1]=0
end
end

return (Bspln)
end

p=3
knot=[-1 -1 -1 -1 0 1 1 1 1]
knot=[knot ones(1,p)]
nb=size(knot,2)-p-1
ndt=10 # t steps
t1=minimum(knot)
t2=maximum(knot)
t=t1:(t2-t1)/ndt:t2
nt=size(t,1)
y=zeros(nb,p+1,nt)
for it=1:nt
Bspln = Bspline(p,knot,t[it])
end

Something went wrong when you quoted your code. There should be a preview pane to the right of your input pane that will show you whether you did it correctly.

You should use triple backticks for quoting. Looks like you used something else.

now It looks better???

Please use three back-tics like this ``` to quote your code.

The following gives no errors, please copy paste and report back if you get errors.

function Bspline(p,knot,t)
    nb = size(knot,2)-p-1
    Bspln = zeros(nb,p+1)
    for ip = 0:p
        for i = 1:(nb-ip)
            Bspln[i,ip+1] = 0
        end
    end
    return Bspln
end

p = 3
knot = [-1 -1 -1 -1 0 1 1 1 1]
knot = [knot ones(1,p)]
nb = size(knot,2)-p-1
ndt = 10 # t steps
t1 = minimum(knot)
t2 = maximum(knot)
t = t1:(t2-t1)/ndt:t2
nt = size(t,1)
y = zeros(nb,p+1,nt)
for it = 1:nt
    Bspln = Bspline(p,knot,t[it])
end

This errors with it not being defined. Correcting to ait, it runs.