I'm learning Rust and have a (apparently) working example compartmental ode model using the "pharmsol" crate to solve the ode's. A lot of the workings of the pharmsol crate are still a black box, to me! My next quest is to get the model to output results to a text file. This code works correctly to output the results of 3 fluxes, over time (iterations) to the screen
// Print the grouped predictions to screen.
for (outeq, preds) in &groups {
println!("Output Equation {} has {} predictions:", outeq, preds.len());
for pred in preds {
println!("{:#?}", pred);
}
What I want to accomplish is to (output) write this same information (presumably pred) to a file (on linux) using the "std::fs" crate. I've made several attempts at the syntax but still don't have it correct. Given what information I have, can you suggest the correct code/syntax to output to a file, named perhaps "predoutput.txt" into the current working directory? Thx. J