Commit 056d91e
Fix ifelse support and update ModelingToolkit compat
This PR fixes issue #36 by:
1. Adding an `ifelse` helper function definition in MATLAB
- MATLAB doesn't have a built-in `ifelse` function, but Symbolics.jl
generates code using `ifelse(cond, a, b)` for the MATLAB target
- We now define `ifelse = @(cond, a, b) cond .* a + ~cond .* b;`
before evaluating the generated MATLAB code
2. Updating ModelingToolkit compat to support versions 8, 9, 10, 11
- The original error "TypeError: non-boolean (Num) used in boolean context"
was fixed in newer ModelingToolkit/Symbolics versions
- Added compatibility shim for the `states` -> `unknowns` API change
Fixes #36
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent b7036d5 commit 056d91e
2 files changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
7 | 14 | | |
8 | 15 | | |
9 | 16 | | |
| |||
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
60 | | - | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
| |||
0 commit comments