Notice
Recent Posts
Recent Comments
Link
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

자료 매번 검색하기 귀찮아서 만든 블로그

Julia - jld 사용하여 변수 값 저장, 불러오기 본문

Julia

Julia - jld 사용하여 변수 값 저장, 불러오기

쿠키아버님 2022. 11. 4. 13:56

JLD 패키지 :  https://github.com/JuliaIO/JLD.jl 

 

GitHub - JuliaIO/JLD.jl: Saving and loading julia variables while preserving native types

Saving and loading julia variables while preserving native types - GitHub - JuliaIO/JLD.jl: Saving and loading julia variables while preserving native types

github.com

 

 

간단한 예시

using JLD

a = [1,2,3]

save("my.jld", "MyKey", a)

my.jld는 Dictionary 형태로 저장되었으며, "MyKey" 에는 key의 이름을 지정해준다.

 

myfile = load("my.jld")

Dict{String, Any} with 1 entry:
  "MyKey" => [1, 2, 3]

 

 

read, write도 가능하다

jldopen("my.jld", "r") do file
    read(file, "MyKey")
end


3-element Vector{Int64}:
 1
 2
 3