Calling functions from another script

Hi Guys

I am currently converting my FEM toolbox I made on Matlab to Julia. I am having issues calling functions from other scripts.

the function is:

function assembly(q, T, ke, npe, dof, n)
    # Create a blank global stiffness matrix
    a = size(n)
    m_size = dof * n[a[1], 1]
    Kdummy = zeros(m_size, m_size)

    nodes = T[1, 2:npe+1]'
    A = zeros(npe, dof)
    for i = 1:npe
        A[i, :] = q[nodes[i], :]
    end

    B = reshape(A, npe * dof, 1)
    Q = sort(B)

    Kdummy[Q, Q] .= ke .+ Kdummy[Q, Q]
    return Kdummy, A, Q
end

This is how I am calling the script:

include("C:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\FEM-functions.jl")

This is the error I get:

ERROR: syntax: invalid escape sequence
Stacktrace:
[1] top-level scope
@ c:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\test.jl:1

ERROR: syntax: invalid escape sequence
Stacktrace:
[1] top-level scope
@ c:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\test.jl:1

ERROR: syntax: invalid escape sequence
Stacktrace:
[1] top-level scope
@ c:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\test.jl:1

It might be due to the backslash \ in the file path, try using a raw"" string, i.e.,

include(raw"C:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\FEM-functions.jl")

Your error is invalid escape sequence. The “\” is an escape character, meaning the next character is viewed differently. @baggepinnen’s solution should work.

https://docs.julialang.org/en/v1/manual/strings/#man-raw-string-literals

The following should also work:

include(“C:\Users\mishal.mohanlal\Downloads\Mishal FEM files Julia\FEM files\FEM-functions.jl”)

Or the following:

include("C:/Users/mishal.mohanlal/Downloads/Mishal FEM files Julia/FEM files/FEM-functions.jl")