DelimitedFiles not working

hi, im new to julia. coming from matlab.

im just trying the language out, just playing with it before jumping in completely.
i cant get DelimitedFiles to work, to simply read a txt file.
When i type:

using DelimitedFiles
Coor=readdlm("test.txt")
print(Coor)

i get:

LoadError: ArgumentError: Cannot open 'test.txt': not a file

in expression starting at untitled-8ead38e87ae54c024af70d734f3fca9a:3

#readdlm_auto#9(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::String, ::Char, ::Type, ::Char, ::Bool) at DelimitedFiles.jl:233

readdlm_auto at DelimitedFiles.jl:233 [inlined]

#readdlm#5 at DelimitedFiles.jl:172 [inlined]

readdlm at DelimitedFiles.jl:172 [inlined]

#readdlm#3 at DelimitedFiles.jl:118 [inlined]

readdlm(::String) at DelimitedFiles.jl:118

top-level scope at none:0

the file “test.txt” is a simple matrix 4x4

btw, im on linux mint, atom ide with junolab

Welcome!

That error just means that your file is not located in Julia’s current working directory (whatever directory the julia command was run from). You can check Julia’s working directory with:

pwd()

To open a file in some other directory, you can either use its full path:

readdlm("/path/to/your/files/test.txt")

or you can change the working directory:

cd("/path/to/your/files")
readdlm("test.txt")
5 Likes

In REPL

; cd /path/to/your/files

works also.