matlab-uihtml-app-builder
БесплатноБез исполняемых скриптовНе проверенBuild interactive web applications using HTML/JavaScript interfaces with MATLAB computational backends via the uihtml component. Use when creating HTML-based…
Об этом скилле
MATLAB uihtml App Builder
This skill covers how to build interactive web applications that combine HTML/JavaScript interfaces with MATLAB computational backends using the uihtml component. The HTML side handles the UI; MATLAB does the computation.
When to Use This Skill
- Building interactive MATLAB apps with HTML/JavaScript interfaces
- Creating web-based UIs for MATLAB applications
- Building responsive MATLAB GUIs with HTML/CSS/JS
- When user mentions: uihtml, HTML, JavaScript, web app, web interface, interactive GUI
- Combining web UI design with MATLAB computational power
- Creating calculator apps, data visualizers, or form-based MATLAB tools
Core Architecture
The Four Components
- HTML Interface - User interface with buttons, forms, displays
- JavaScript Logic - Event handling and UI interactions
- MATLAB Backend - Computational engine and data processing
- uihtml Component - Bridge between HTML and MATLAB
Communication Patterns
The uihtml component enables bidirectional communication between JavaScript and MATLAB through several mechanisms:
Pattern 1: MATLAB → JavaScript (Data Property)
Use Case: Sending data from MATLAB to update the HTML interface
% MATLAB side
h.Data = "Hello World!";
// JavaScript side
htmlComponent.addEventListener("DataChanged", function(event) {
document.getElementById("display").innerHTML = htmlComponent.Data;
});
Pattern 2: JavaScript → MATLAB (Events)
Use Case: Triggering MATLAB functions from user interactions
// JavaScript side - send event to MATLAB
htmlComponent.sendEventToMATLAB("Calculate", expression);
% MATLAB side - receive and handle event
h.HTMLEventReceivedFcn = @handleEvent;
function handleEvent(src, event)
eventName = event.HTMLEventName;
eventData = event.HTMLEventData;
% Process event...
end
Pattern 3: MATLAB → JavaScript (Custom Events)
Use Case: Sending computed results or status updates to JavaScript
% MATLAB side - send custom event to JavaScript
sendEventToHTMLSource(h, "ResultChanged", result);
// JavaScript side - listen for custom event
htmlComponent.addEventListener("ResultChanged", function(event) {
document.getElementById("display").textContent = event.Data;
});
Pattern 4: Complex Data Transfer
Use Case: Passing structured data between MATLAB and JavaScript
% MATLAB side - struct data gets JSON encoded automatically
itemData = struct("ItemName","Apple","Price",2,"Quantity",10);
h.Data = itemData;
// JavaScript side - access as object properties
htmlComponent.Data.ItemName // "Apple"
htmlComponent.Data.Price // 2
htmlComponent.Data.Quantity // 10
Important: decoding is automatic in both directions.
- A JS object sent via
sendEventToMATLABarrives onevent.HTMLEventDataalready converted to a MATLAB struct. Do not calljsondecode; it will fail on a struct. - A MATLAB struct sent via
sendEventToHTMLSourcearrives onevent.Dataalready as a JavaScript object. Do not callJSON.parse; it will fail on an object. - Field names round-trip exactly: a JS
{x0: 1}becomes a MATLABstruct('x0', 1), notstruct('x_0', ...)or similar. - Numeric scalars arrive as MATLAB
double. Wrap field reads withdouble(data.x0)if you want to be defensive about types.
Critical Rules
Security Requirements
ALWAYS set
HTMLSource = 'trusted'when using local HTML files:h.HTMLSource = fullfile(pwd, 'myapp.html'); % This is treated as trusted automatically for local filesMUST validate all input from JavaScript before processing in MATLAB
NEVER use
eval()on user input without strict sanitizationALWAYS restrict allowed characters in user input for expressions
Error Handling
ALWAYS wrap MATLAB event handlers in try-catch blocks:
function handleEvent(src, event)
eventName = event.HTMLEventName;
eventData = event.HTMLEventData;
try
% Process the event
result = processData(eventData);
% Send result back to JavaScript
sendEventToHTMLSource(src, 'ResultEvent', result);
catch ME
% Handle errors gracefully
fprintf('Error: %s\n', ME.message);
sendEventToHTMLSource(src, 'ErrorEvent', ME.message);
end
end
Data Validation
ALWAYS validate user input before processing:
function result = validateExpression(expression)
allowedChars = '0123456789+-*/.() ';
if ~all(ismember(expression, allowedChars))
error('Invalid characters in expression');
end
% Additional validation...
result = true;
end
File Organization
Follow this directory structure:
project/
├── app.m # Main MATLAB function
├── app.html # HTML interface
├── README.md # Usage instructions
└── examples/
Установить matlab-uihtml-app-builder в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл matlab-uihtml-app-builder?
Build interactive web applications using HTML/JavaScript interfaces with MATLAB computational backends via the uihtml component. Use when creating HTML-based MATLAB apps, JavaScript MATLAB interfaces, web UIs with MATLAB, interactive MATLAB GUIs, or when user mentions uihtml, HTML, JavaScript, web apps, or web interfaces.
Как установить скилл matlab-uihtml-app-builder?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл matlab-uihtml-app-builder запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic