Adds the string to the Octave script. At the end of the line a semicolon is appended. If the string contains two consecutive dollar signs (i.e. `$$`) these will be replaced by the matrix `m`. # Example ``` # #[macro_use] extern crate rustml; use rustml::octave::*; use rustml::*; # pub fn main() { let m = mat![1, 2, 3; 4, 5, 6]; let s = builder().add_matrix("x = $$", &m); assert_eq!( s.to_strin
(&self, t: &str, m: &Matrix<T>)
| 165 | /// # } |
| 166 | /// ``` |
| 167 | pub fn add_matrix<T: fmt::Display + Clone>(&self, t: &str, m: &Matrix<T>) -> OctaveScriptBuilder { |
| 168 | |
| 169 | let mut s = "[".to_string(); |
| 170 | |
| 171 | for (idx, r) in m.row_iter().enumerate() { |
| 172 | if idx > 0 { |
| 173 | s = s + ";"; |
| 174 | } |
| 175 | s = s + &self.join(&r); |
| 176 | } |
| 177 | s = s + "]"; |
| 178 | |
| 179 | self.add(&t.replace("$$", &s)) |
| 180 | } |
| 181 | |
| 182 | /// Adds the string to the Octave script. |
| 183 | /// |
no test coverage detected