Save Simulink's logged data to a MAT file
cm_model_logs_saveSave Simulink logged signals and To Workspace data to a MAT file after a CarMaker for Simulink run, including base and model workspace variables; use it to verify which signals are logged.
Instructions
After a CarMaker for Simulink run: write what Simulink logged (signals marked for logging and To Workspace blocks) to a MAT file, with the base workspace and the model workspace as one struct each (variables: signals, base_workspace, model_workspace, info); the answer lists signal_names. Requires an idle simulation. The result file (.erg) holds CarMaker's quantities, this the Simulink side. To see whether a signal is logged, run with save_logs=true and read signal_names.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "cm_model_logs_save"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | MAT file to write, inside the project (default: next to the last result file, with the same name) | |
| logs | No | inspector: every signal the Simulation Data Inspector holds for the last run (logged signals and To Workspace blocks, complete). workspace: the logging variables in the base workspace as they are | inspector |
| model | No | Loaded Simulink model (default: the active one) | |
| format | No | dataset: a Simulink.SimulationData.Dataset. struct: plain arrays (name, time, values, units, block) that load without Simulink | dataset |
| overwrite | No | Replace the file if it exists | |
| timeout_s | No | Longest time MATLAB may take to write the file | |
| base_workspace | No | Include the base workspace's variables | |
| model_workspace | No | Include the model workspace's variables |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||