matlab/matlab-agentic-toolkit / skills-catalog/matlab-app-building/matlab-build-app
matlab-build-app
UnverifiedBuild MATLAB apps from requirements to working code. Asks discovery questions (or skips them when the path is known), recommends UIFigure or UIHTML architecture, identifies layout archetype (Dashboard, Explorer, Tabbed, Wizard, Canvas), produces an implementation plan, and executes the build. For UIFigure apps, optionally serializes as App Designer (.mlapp or plain-text .m + .xml). Use when a user wants to build a MATLAB app, create a GUI, make an interactive tool, build a uifigure app, build a uihtml app, build an App Designer app, build a .mlapp app, build a plain-text App Designer app, or asks which approach to use. Also use when user describes spatial layout needs: dashboard, control panel, sidebar, tabs, wizard, stepper, canvas, workspace.
references/uihtml/js-testing-debugging.md
View on GitHub# Testing & Debugging
Testing and debugging patterns for JavaScript in MATLAB uihtml apps.
## Console-Based Testing
Test JS functions directly from the browser console (F12 in the uihtml web view):
```javascript
// Expose key objects for console debugging
window.app = { model, viewModel, view };
// Then in console:
// app.viewModel.processCommand(42)
// app.model.data
```
## Simulating MATLAB Events
Test JS event handlers without MATLAB running by dispatching synthetic events:
```javascript
// In browser console: simulate a MATLAB ResultReady event
const fakeEvent = new CustomEvent("ResultReady");
fakeEvent.Data = { value: 42, status: "ok" };
htmlComponent.dispatchEvent(fakeEvent);
```
## Debug Logging Toggle
Add a debug mode that logs all bridge communication:
```javascript
const DEBUG = true;
function sendToMATLAB(eventName, data) {
if (DEBUG) {
console.log("[JS -> MATLAB] " + eventName + ":", JSON.stringify(data));
}
htmlComponent.sendEventToMATLAB(eventName, data);
}
```
## Unit Testing Pure Functions
For logic-heavy apps, test pure functions independently:
```javascript
// utils/formatting.js
export function formatTemperature(celsius, unit) {
if (unit === 'F') return (celsius * 9/5 + 32).toFixed(1) + ' F';
if (unit === 'K') return (celsius + 273.15).toFixed(1) + ' K';
return celsius.toFixed(1) + ' C';
}
// Test in console or test file:
// formatTemperature(100, 'F') === '212.0 F'
// formatTemperature(0, 'K') === '273.1 K'
```
## MATLAB Side Logging
Add `fprintf` in MATLAB to see what JS is sending:
```matlab
function handleEvent(src, event)
fprintf('[MATLAB] Received: %s\n', event.HTMLEventName);
fprintf('[MATLAB] Data type: %s\n', class(event.HTMLEventData));
disp(event.HTMLEventData);
% ... handle event
end
```
## JavaScript Side Logging
Use `console.log` to trace communication flow:
```javascript
// Inside setup()
htmlComponent.addEventListener("DataChanged", function(event) {
console.log("[JS] DataChanged:", JSON.stringify(htmlComponent.Data));
updateUI(htmlComponent.Data);
});
```
## Debugging Steps for Communication Failures
1. **Test MATLAB to JS first** — set `h.Data = struct('test', 123)` and check if `DataChanged` fires
2. **Test JS to MATLAB next** — call `sendEventToMATLAB` with simple string data and check `fprintf` output
3. **Check data types** — `fprintf('class: %s\n', class(event.HTMLEventData))` in MATLAB; `console.log(typeof event.Data)` in JS
4. **Verify setup() is called** — add `console.log("setup called")` as the first line of `setup()`
5. **Check for silent errors** — ensure try-catch exists on both sides
## Browser Developer Tools
Access dev tools in the uihtml embedded browser:
- **Console tab** — see JS errors and `console.log` output
- **Elements tab** — inspect and modify DOM in real time
- **Network tab** — not typically needed (no HTTP in uihtml), but useful for standalone web apps
----
Copyright 2026 The MathWorks, Inc.
----
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |