Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/computational-biology/simbiology-build-model

simbiology-build-model

Unverified

Build, modify, and diagram SimBiology models — API reference, helper functions, and layout patterns. Use when constructing or editing models programmatically or visually.

references/api-cheatsheet-guidance.md

View on GitHub
# SimBiology Diagram API Cheatsheet

Quick reference for the `simbio.diagram.*` functions used to manipulate
Model Builder diagrams programmatically. All functions require the Model
Builder app to be open with the model loaded.

---

## Block Functions

### `simbio.diagram.getBlock(sObj)` — Query block properties

```matlab
sv = simbio.diagram.getBlock(species);         % all properties as struct
pos = simbio.diagram.getBlock(species, 'Position');  % single property
```

For cloned species, specify the connected expression:
```matlab
pos = simbio.diagram.getBlock(species, reaction, 'Position');
```

### `simbio.diagram.setBlock(sObj, ...)` — Set block properties

```matlab
simbio.diagram.setBlock(species, 'Position', [x y w h]);
simbio.diagram.setBlock(species, 'FaceColor', 'yellow', 'FontSize', 14);
simbio.diagram.setBlock(species, reaction, 'Position', [x y w h]);  % cloned
```

### Block Properties

| Property         | Type / Values                                       | Notes                                      |
|------------------|-----------------------------------------------------|--------------------------------------------|
| `Position`       | `[x y width height]`                                | Origin is top-left of diagram (0,0)        |
| `FaceColor`      | RGB triplet or color name                           | Block fill color                           |
| `EdgeColor`      | RGB triplet or color name                           | Block border color                         |
| `TextColor`      | RGB triplet or color name                           | Label text color                           |
| `FontName`       | String (e.g. `'Arial'`, `'Helvetica'`)              |                                            |
| `FontSize`       | Positive scalar                                     |                                            |
| `FontWeight`     | `'plain'`, `'bold'`, `'italic'`, `'bold italic'`    |                                            |
| `TextLocation`   | `'top'`, `'left'`, `'bottom'`, `'right'`, `'center'`, `'none'` |                              |
| `Shape`          | `'rounded rectangle'`, `'rectangle'`, `'oval'`, `'triangle'`, `'hexagon'`, `'chevron'`, `'parallelogram'`, `'diamond'` | Compartments: only `'rounded rectangle'` or `'rectangle'` |
| `Rotate`         | 0-360                                               | Cannot rotate compartments                 |
| `Pin`            | `true` / `false`                                    | Prevents block from being moved in the UI  |
| `Visible`        | `true` / `false`                                    | Compartments are always visible (R2022a+)  |
| `ExpressionLines`| `'show'` / `'hide'`                                 | Reactions and rules only                   |
| `Connections`    | (read-only) Array of connected objects               |                                            |
| `Cloned`         | (read-only) `true` / `false`                        | Species only                               |
| `Object`         | (read-only) The SimBiology object                    |                                            |

---

## Line Functions

### `simbio.diagram.getLine(sObj)` — Query line properties

```matlab
sv = simbio.diagram.getLine(species);             % all lines from species
sv = simbio.diagram.getLine(species, reaction);    % specific line
```

### `simbio.diagram.setLine(sObj, ...)` — Set line properties

```matlab
simbio.diagram.setLine(reaction, 'Color', 'red', 'Width', 2);
simbio.diagram.setLine(species, reaction, 'Color', [0.6 0.2 0.6], 'Width', 3);
```

### Line Properties

| Property      | Type / Values              | Notes                          |
|---------------|----------------------------|--------------------------------|
| `Color`       | RGB triplet or color name  | Line color                     |
| `Width`       | Positive scalar            | Line thickness                 |
| `Connections` | (read-only) `[obj1 obj2]`  | The two connected objects      |

---

## Clone Functions

### `simbio.diagram.splitBlock(speciesObj)` — Clone a species block

Creates one copy of the species block per connected expression (reaction
or rule). Returns the list of expressions.

```matlab
expr = simbio.diagram.splitBlock(sp);
% Position each clone near its reaction:
simbio.diagram.setBlock(sp, expr(1), 'Position', [x1 y1 30 15]);
simbio.diagram.setBlock(sp, expr(2), 'Position', [x2 y2 30 15]);
```

### `simbio.diagram.joinBlock(speciesObj, exprObj)` — Merge clones

Joins all clones back into a single block, keeping the one connected to
`exprObj`.

```matlab
simbio.diagram.joinBlock(sp, expr(2));  % keep clone at expr(2)
```

---

## Common Patterns

### Read all positions in a model

```matlab
model = getModelByUUID(modelId);
allSpecies = model.Species;
for i = 1:numel(allSpecies)
    pos = simbio.diagram.getBlock(allSpecies(i), 'Position');
    fprintf('%s: [%d %d %d %d]\n', allSpecies(i).Name, pos);
end
```

### Batch-set face color for all species in a compartment

```matlab
comp = sbioselect(model, 'Type', 'compartment', 'Name', 'Central');
species = comp.Species;
simbio.diagram.setBlock(species, 'FaceColor', [0.53 0.81 0.98]);
```


----

Copyright 2026 The MathWorks, Inc.

----
rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).Stars: 198kUpdated Claude CodeCodexUnverifiedInstall
doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.Stars: 198kUpdated Claude CodeCodexVerifiedInstall