load
load(path)
Input: path · Output: no output
What it is
Restores every variable a save/save_all call wrote. path (string) is the file to read.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
load(path) | path stringnot documented yet | no output | Restores every variable a save/save_all call wrote. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
write_csv(df, "data.csv")
df2 = read_csv("data.csv")
print(df2)
table.write(df, "data2.csv")
df3 = table.load("data2.csv")
print(df3)
output
x y - -- 1 10 2 20 3 -5 x y - -- 1 10 2 20 3 -5
from tour
x = 1 to 5
A = [1, 2; 3, 4]
m = ols_model([1;2;3;4], [2;4;6;8]) # a fitted model round-trips too
save_all("session.json") # every variable currently in scope
# ...later, in a fresh session...
load("session.json") # restores x, A, m into the workspace
p = predict(m, [5]) # -> [10]
from fundamentals
How it works
load(path) — restore every variable a save/save_all call wrote, under the same names, into the top-level workspace (overwriting any existing variable of the same name, the same "load replaces" semantics MATLAB's own load has).
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.