Chris,
I have made up both “vertical” and “horizontal” *.dat files for testing (writing a *.dat file from VBA automatically puts a “,” between the data values rather than a space if you use the *.txt format. I think the “,” is a safer bet going forward). When I run the code below I keep getting an error (see below), no matter what *.dat data file I use. Any ideas?
Thanks,
Peter
using DelimitedFiles
Alpha_Leaf_Air, Latent, Sigma, e_Can = readdlm(“C:\Users\peter\Documents\Julia_Code\Learning\MyFile_Horizontal.dat”);
println(Latent)
ERROR: LoadError: BoundsError: attempt to access 1×1 Array{Any,2} at index [2]
Stacktrace:
[1] getindex at .\array.jl:809 [inlined]
[2] indexed_iterate(::Array{Any,2}, ::Int64, ::Int64) at .\tuple.jl:82
[3] top-level scope at c:\Users\peter\Documents\Julia_Code\Learning\Read_Write_Dat_File.jl:9
[4] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1088
[5] include_string(::Module, ::String, ::String) at .\loading.jl:1096
[6] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at .\essentials.jl:710
[7] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at .\essentials.jl:709
[8] inlineeval(::Module, ::String, ::Int64, ::Int64, ::String; softscope::Bool) at c:\Users\peter.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\VSCodeServer\src\eval.jl:185
[9] (::VSCodeServer.var"#61#65"{String,Int64,Int64,String,Module,Bool,VSCodeServer.ReplRunCodeRequestParams})() at c:\Users\peter.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\VSCodeServer\src\eval.jl:144
[10] withpath(::VSCodeServer.var"#61#65"{String,Int64,Int64,String,Module,Bool,VSCodeServer.ReplRunCodeRequestParams}, ::String) at c:\Users\peter.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\VSCodeServer\src\repl.jl:124
[11] (::VSCodeServer.var"#60#64"{String,Int64,Int64,String,Module,Bool,Bool,VSCodeServer.ReplRunCodeRequestParams})() at c:\Users\peter.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\VSCodeServer\src\eval.jl:142
[12] hideprompt(::VSCodeServer.var"#60#64"{String,Int64,Int64,String,Module,Bool,Bool,VSCodeServer.ReplRunCodeRequestParams}) at c:\Users\peter.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\VSCodeServer\src\repl.jl:36
[13] (::VSCodeServer.var"#59#63"{String,Int64,Int64,String,Module,Bool,Bool,VSCodeServer.ReplRunCodeRequestParams})() at c:\Users\peter.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\VSCodeServer\src\eval.jl:110
[14] with_logstate(::Function, ::Any) at .\logging.jl:408
[15] with_logger at .\logging.jl:514 [inlined]
[16] (::VSCodeServer.var"#58#62"{VSCodeServer.ReplRunCodeRequestParams})() at c:\Users\peter.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\VSCodeServer\src\eval.jl:109
[17] #invokelatest#1 at .\essentials.jl:710 [inlined]
[18] invokelatest(::Any) at .\essentials.jl:709
[19] macro expansion at c:\Users\peter.vscode\extensions\julialang.language-julia-1.0.10\scripts\packages\VSCodeServer\src\eval.jl:27 [inlined]
[20] (::VSCodeServer.var"#56#57")() at .\task.jl:356
in expression starting at c:\Users\peter\Documents\Julia_Code\Learning\Read_Write_Dat_File.jl:9
(Attachment MyFile_Horizontal.dat is missing)
(Attachment MyFile_Vertical.dat is missing)