pub fn eval(input: &str) -> OctaveResults
Expand description
Evaluate lines of Octave code
use mocktave::eval;
let should_be_seven = eval("a = 5+2");
assert_eq!(*(should_be_seven.get_scalar_named("a").unwrap()), 7_f64);
Examples found in repository?
examples/invert_matrix.rs (line 11)
3 4 5 6 7 8 9 10 11 12 13 14
fn main() {
let script = " \
z = 5.24; \
m = z*inv(eye(5, 5)); \
m(1, 2) = 5; \
a = 5; \
";
let y = mocktave::eval(script);
println!("{y:#?}");
}