diffai_core/parsers/
matlab.rs1use anyhow::Result;
2use matfile::MatFile;
3use serde_json::Value;
4use std::fs::File;
5use std::path::Path;
6
7pub fn parse_matlab_file(path: &Path) -> Result<Value> {
9 let file = File::open(path)?;
10 let _mat_file = MatFile::parse(file)?;
11
12 let mut result = serde_json::Map::new();
13 let arrays = serde_json::Map::new();
14
15 result.insert(
17 "model_type".to_string(),
18 Value::String("matlab".to_string()),
19 );
20 result.insert(
21 "file_path".to_string(),
22 Value::String(path.to_string_lossy().to_string()),
23 );
24 result.insert("arrays".to_string(), Value::Object(arrays));
25
26 Ok(Value::Object(result))
27}