Updated Discussions

Many of us have someone in our lives whose hearing has gradually changed with age. Maybe it's a grandparent who leans in a little closer at the dinner table, or a friend who enjoys a chat more in a quiet cafe than a busy one. For many people, hearing loss over the years becomes part of everyday life.
Behind every hearing instrument is an engineering team trying to help people keep enjoying those conversations.
We'd love to hear from you:
  • Has hearing changed the way someone you know enjoys music, conversations or learning?
  • If you've worked on audio, hearing aids or wearables, what inspired you, and what made it hard?
Join us at MATLAB Expo Online for the hands-on workshop Designing For Every Ear. Together we will explore the technologies right in MATLAB.
This Week's Quiz 69 responses
Sign in to participate
At the present time, the following problems are known in MATLAB Answers itself:
  • Symbolic output is not displaying. The work-around is to disp(char(EXPRESSION)) or pretty(EXPRESSION)
  • Symbolic preferences are sometimes set to non-defaults
I have MATLAB R2026b, the MATLAB Agentic Toolkit, and Claude Code installed.
In the first session, I asked Claude (Opus 5.5, High effort) to review the game rules, suggest MATLAB Agentic Toolkit skills, install them inside the project folder, and create a CLAUDE.md file.
In the second session, I asked Claude to create a combat game in which the player controls a simple stick figure wielding a club; clicking makes the figure swing the club. Simple monsters approach the player and drain the player’s health on contact, while hitting a monster with the club eliminates it. The game has an old-school 2D look, with a dark blue, star-filled background and light blue characters.
That's it. You can see result here: CLUB NIGHT
My best score until now is 2060.
Let me know your best score in the comments.
CLUB NIGHT - GAME OVER
Want to try an AI coding agent for the One-Button Game Contest? In this post, I'll show you how to connect OpenCode to MATLAB and use it to create your first game. You can get everything set up and start building in less than 20 minutes.
Here's what you'll need:
For those who already have local coding agents like Claude or Codex, you can skip a few steps but will still need to ensure the MCP connection to MATLAB and leverage the contest starter project from File Exchange.
Selecting an LLM
Here is a list of OpenCode's cloud-hosted models: https://opencode.ai/v2/docs/console/models#free-models. These can change unexpectedly and your requests may be rate limited, but I haven't run into any issues so far. Starting with a cloud-hosted model means you don't have to install additional tools or download rather large model files.
I'll be using GLM-5.3-Flash. The documentation says "Its provider follows a zero-retention policy and does not use your data for model training" which is nice.
If you'd prefer to use a locally running model, likely for security reasons, and if your hardware supports it, follow the instructions here: https://github.com/matlab/matlab-local-agent-quickstart.
Configuring OpenCode
You've installed the MATLAB MCP server but OpenCode doesn't know about it yet. You'll need to find or create a configuration file to make that connection. The file is named opencode.json and can be found (or created) in the .config directory in your user path:
C:\Users\<username>\.config\opencode\opencode.json
This is an example for a Windows system:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"matlab": {
"enabled": true,
"type": "local",
"command": [
"C:\\Users\\<username>\\.matlab\\agentic-toolkits\\bin\\matlab-mcp-server.exe",
"--matlab-root",
"C:\\Program Files\\MATLAB\\R2026a"
]
}
}
}
Note: The path to MATLAB only needs to point to the directory, the executable is appended automatically by the MCP server.
Verify the MCP connection
  1. Restart OpenCode and verify the connection to the MATLAB MCP server is working. MATLAB doesn't have to be running for the connection to work.
  2. Navigate to File > Settings > Extensions > MCPs. You should see MATLAB listed and toggled 'on'.
Note: Ensure you've selected the model you want. You can do this using the list box below the prompt. The following image shows that GLM-5.3-Flash Free is selected.
You can now create your first OpenCode session and ask "Can you connect to MATLAB?" or "What tools are available via the MATLAB MCP server?". If it's working you should see the agent response acknowledging it can connect to MATLAB.
Creating a game
In this step, you''ll use OpenCode to create a MATLAB game by simply having a conversation. You'll see MATLAB open and edits being made to the game.m file. At any time you can edit the MATLAB code or simply tell the OpenCode agent what you want changed.
  1. Download the starter kit from the File Exchange if you haven't already done so. Clicking on the New Entry button in the contest pages also provides the link: https://www.mathworks.com/matlabcentral/fileexchange/185098-matlab-one-button-game-minihack-starter-project
  2. Extract it to a directory of your choice. Then, open the project (.proj file) in MATLAB. Doing this runs a bootstrap function that installs dependencies.
  3. Create a new OpenCode project by selecting the Add project link/button, then select the directory for the contest starter kit. OpenCode needs to know where on your system to create the new session.
  4. Create a new OpenCode session, double check your model choice is visible, and then simply tell OpenCode what you want to do by typing in your request. For example, "I'd like to create a one-button game for the MATLAB Central contest. Can you suggest an idea?".
  5. OpenCode may ask clarifying questions and spend a few minutes 'thinking' (you can click and expand these UI elements to see what it's doing). It will use MATLAB to iterate on and validate the game code, making sure the tests pass. Once ready, it'll run the game for you. Or, you can start the game by running minihackContest.play in the command window.
That's it! You've created your first game with the help of an AI coding agent and MATLAB.
Once you're happy with your game, you can submit it to the contest by entering minihackContest.submit in the MATLAB Command Window.
Watch me do this on YouTube: https://youtu.be/0R_kYatC_Ag
Reply below and let me know if you found these instructions helpful and if you ran into any issues. Also, I'm interested to know which models you used. Thanks.
In our previous Mini Hack contests, you amazed us with creative images, animations, and videos. This year, we’re trying something new: Let’s make games!
With the help of Agentic AI, you don’t have to write all the code yourself. Bring your idea, and creativity, then work with AI to turn it into a MATLAB game.
New to Agentic AI? No problem!
We’ve created a step-by-step tutorial that can help you set up the MATLAB Agentic AI workflow in about 20 minutes, including a video to walk you through the process. This contest is about learning while having fun. We want you to experience the MATLAB Agentic AI workflow by actually using it to build something.
And don’t just create; share what you learn! Create a Tips & Tricks post to share your Agentic AI experience, discoveries, and useful tips with the community.
So get set up, start experimenting, have fun creating, and win big prizes! 🎁
🎮Ready? Go!!!✨✨✨
I started my game for this contest, Stack OverDad, one month before the contest began. Dad tells programming jokes at the dinner table, and you have to laugh at the right moment. I was very happy with it. It had a dog, a little brother with a spoon, a window with a sun that goes down, fifty jokes, and many small animations.
Then the contest started, and I read the rules again. One line said: each entry is limited to 10,000 characters of MATLAB code.
My code had more than 70,000 characters.
So, as you can guess, the next hourse were cut, test, cut, test, cut... In this post, I will tell you what I learned on the way (from my AI friend!). Some of it surprised me.
Step 1: Cut What the Player Does Not Feel
For every part of the game, I asked: "Does the player really feel this?"
The dog: cute, but no. The brother: funny, but no. The sunset: nobody looks at the window when Dad tells a joke. Forty jokes: a game only uses ten anyway.
This was the biggest step, and the hardest, because I liked all of these things. But the game did not get worse. It got clearer. After this, my file had about 9,800 characters. I was done!
Step 2: The Surprise
The contest project has a command to check the game before you submit it:
minihackContest.validate
I ran it, and it said:
Validation failed: game.m exceeds the character limit (16145 / 10000, comments excluded).
16,145? My file had 9,800 characters. I counted again. It still had 9,800.
So I opened the validator to see how it counts. This is the line:
charCount = strlength(char(tree2str(mtree(gameFile, '-file'))));
mtree reads the code into a tree, and this removes the comments. Then tree2str writes the code again, in a clean, standard layout. The validator counts that text, not my file.
And the clean layout is not short at all. For example, this one line of mine:
if p,pr(s.T);end
comes back from tree2str like this:
if p
pr( s.T );
end
Every statement gets its own line. Every line gets indentation. Every f(a,b) becomes f( a, b ), and every [1 2 3] becomes [ 1, 2, 3 ]. My short style was not short anymore.
The good news: now I knew the real rule, so I could play by it.
Step 3: What Is Cheap and What Is Expensive
  • Expensive: many statements, deep nesting, and long lists of numbers.
  • Cheap: text inside a string. tree2str does not change a string at all.
So the plan was: fewer statements, less nesting, and move numbers into strings.
Example 1: Many Values in One Statement
s.st = 3;
s.t0 = t;
s.la = -1;
becomes one statement with deal:
[s.st, s.t0, s.la] = deal(3, t, -1);
Example 2: A Small if Without if
if n == 1
s.fl = "TEN?!";
end
With logical indexing, it is one line. If the condition is false, nothing changes:
s.fl(n == 1) = "TEN?!";
Example 3: Many Strings in One String
A list like ["PERFECT!", "GOOD!", "TOO LATE..."] pays for every ", ". One string with a separator is cheaper:
B = split("PERFECT!|GOOD!|TOO LATE...", "|");
All fifteen jokes are now one string too.
Example 4: Numbers Inside a String
This was the biggest trick. My scene (the table, the chairs, Dad, the family) is made of rectangles, ellipses, and polygons. That is hundreds of numbers.
So I stored each number as one character in a string. A character is really a number (its code), so I can turn it back:
v = double(char(z))/20 - 1025; % every character of z becomes one number again
I chose codes from a big block of normal, printable characters. They look like Chinese characters, but they are not words. I only use their codes. One small loop reads the string and draws all the shapes with patch. Now the whole scene costs about one character per number.
One warning from my own mistake: use double(char(z)), not double(z). If z is a string, double(z) gives NaN. My first test showed an empty table because of this.
I kept the readable list of shapes in a separate file, and it writes the packed strings for me.
I Had Help
I worked with an AI assistant the whole way. It read the validator with me, tested many small ideas fast, measured which part of the code cost the most, and rewrote code again and again without getting tired.
But the AI did not decide what the game is. It could tell me that the dog costs 1,700 characters. It could not tell me if the dog is worth it. Every "keep" or "cut" was my choice. I think this is the best way to work with AI: let it do the heavy lifting, and keep the decisions for yourself.
The Result
The validator now says 9,936 characters. The game still has Dad, THE LOOK, Mom's warnings, the family walking out, the ranks, and fifteen jokes.
My advice: run minihackContest.validate early. Do not count the characters yourself, because the validator does not count your file. It counts the clean version of your file.
I hope you have found this helpful. Thank you for reading.
Damdinsvren Bayasgalan
Damdinsvren Bayasgalan
Last activity on 1 Nov 2026 at 23:41

Hello everyone, I am new to Matlab.
I am trying to create an app to export the 5th column into a new sheet in the imported Excel file when I click Export button.
How can I write code in ExportButtonPushed
classdef test < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
ExportButton matlab.ui.control.Button
UITable matlab.ui.control.Table
ImportButton matlab.ui.control.Button
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: ImportButton
function ImportButtonPushed(app, event)
[file, location] = uigetfile( ...
{'*.xlsx;*.xlsm', 'Excel files'; '*.txt', 'Text files'; '*.*', 'All files'}, ...
'File Selector');
figure(app.UIFigure)
if isequal(file, 0), return, end
fullPath = fullfile(location, file);
try
[~,~,ext] = fileparts(fullPath);
if any(strcmpi(ext, {'.xlsx','.xlsm','.xls'}))
T = readtable(fullPath, 'Sheet', 1, 'VariableNamingRule', 'preserve');
else
T = readtable(fullPath, 'VariableNamingRule', 'preserve');
end
catch ME
uialert(app.UIFigure, ME.message, 'Read error');
return
end
if width(T) < 5
uialert(app.UIFigure, 'The file needs at least 5 columns.', 'Import error');
return
end
app.UITable.Data = T;
app.UITable.ColumnName = T.Properties.VariableNames;
lengthlist = T{:,5};
end
% Button pushed function: ExportButton
function ExportButtonPushed(app, event)
Recently, I encountered an issue where solve returned no solution for a system of equations, even though the system obviously has solutions. This can be easy to overlook.
For example:
syms a b c x
equs = [a*x^2+b*x+c==0;
a==1];
St = solve(equs,x)
St = Empty sym: 0-by-1
St is returned as an empty set, suggesting that there is no solution???
However, since a is constrained by the equation a == 1, the correct way is:
S = solve(equs,[x,a])
S = struct with fields:
x: [2×1 sym] a: [2×1 sym]
disp(S.x)
disp(S.a)
Here, a must also be included in the list of variables to solve for. Only then will solve treat a as an unknown, apply the constraint a == 1, and substitute it into the equation during the solving process.
symvar(equs)
Based on the output of the symvar function, a is already identified as one of the symbolic variables (unknowns) in the system of equations. However, the actual behavior of solve appears to contradict this expectation. In practice, a must still be explicitly included in the variable list passed to solve; otherwise, it is treated as a symbolic parameter rather than a variable to be solved for.
Takeaway: When using solve for a system of equations, any symbol that appears in the equations and is constrained by additional equations (such as a == 1) should generally be included in the variable list. Otherwise, solve may treat it as a symbolic parameter rather than an unknown, which can lead to an empty solution set or unexpected results.
Am I missing something here? I'd love to hear your thoughts.
Hi everyone! I am one of the MATLAB Product Managers supporting MATLAB Projects and MATLAB Package Manager. R2026b was a major update for both of these tools, and we are excited to show how you can build software in MATLAB and Simulink using modern software development tools. There is a track session and a workshop that you can attend. Come learn about the simpler matlab.toml file and how your code can finally depend on packages. You can see a preview here:
I have learned that I am never, ever going to use Copilot in Simulink again, and probably never use Copilot in any Microsoft application again either. Two times I asked Copilot for some simple help on how to configure a subsystem block and BOTH TIMES it gave me incorrect information that did not work. After 10 minutes of trying to get accurate information out of Mathworks' own native AI (definitely light on the "I" part), I gave up and when to ChatGPT which immediately gave me the correct answer.
Do better Mathworks. Your bloatware is bad enough, and your rejection of systems engineering standards for your own is also pretty terrible. But your selection of an AI "assistant" is a complete failure.
To celebrate 25 years of MATLAB Central community, we're launching two community contests designed to inspire learning, creativity, and knowledge sharing.
🚀 Now Open: STEM Showcase Contest
Have a great math, science, or engineering concept to share? Create an interactive MATLAB experience that helps others learn, explore, and discover STEM concepts.
Learn more and enter: STEM Showcase Contest
Prizes:
  • STEM domain awards: Amazon Gift Card
  • Weekly prizes: MathWorks T-shirts or socks
  • Exclusive virtual badge
🎮 Coming in November: MATLAB One-Button Game Mini Hack
Can you build a fun game using only one button? Start brainstorming now and get ready for a unique MATLAB Game Mini Hack challenge.
For 25 years, MATLAB Central has been powered by a community that loves learning, building, and sharing knowledge. Whether you're an educator, researcher, engineer, student, or hobbyist, we'd love to see what you create.
Week of October 26, 2026 524 responses

This quiz has ended. You can still submit an answer to see results.

Note: Answering past quizzes does not count toward your streak.

Sign in to participate
MATLAB EXPO Online 2026 is almost here! With 40+ sessions across five technical tracks plus nine live, hands-on workshops, now is a great time to explore the agenda and decide what you don’t want to miss.
Whether you’re interested in AI and Agentic AI, Model-Based Design, electrification, robotics and autonomous systems, or Cloud and DevOps, there’s plenty to choose from.
👉 Register and start planning your MATLAB EXPO experience.
💬 What session or workshop is already on your must-see list? Share it in the comments so others can discover it too!
Week of October 19, 2026 624 responses

This quiz has ended. You can still submit an answer to see results.

Note: Answering past quizzes does not count toward your streak.

Sign in to participate
HDFql
HDFql
Last activity on 25 Oct 2026 at 14:54

As a long-standing request from users, we are happy to announce that HDFql now supports MATLAB for managing HDF5 and MAT files.
In short, HDFql (Hierarchical Data Formal query language) is the first high-level, declarative language for managing HDF5 or MAT data. Designed to be as simple and powerful as SQL, it dramatically reduces the learning effort and time required to work with HDF5. With its intuitive syntax, HDFql provides a clean interface for reading and writing HDF5 data across programming languages (C, C++, Java, Python, C#, Fortran, R, and now MATLAB) and platforms (Windows, Linux, and macOS). In addition, HDFql is based on a flexible parallel architecture that transparently leverages available cores and, in MPI clusters, nodes to efficiently process large volumes of data.
Key benefits of HDFql include enabling users to replace dozens of lines of complex HDF5 code with just a few lines of simple code, helping AI models generate better code using far fewer tokens, and making AI-generated code easier for humans to review.
Happy coding, prompting, or reviewing with HDFql in MATLAB!
Martin
Martin
Last activity on 23 Oct 2026 at 21:00

We use Timecontrol for statistic automations. Yesterday at 2026-10-220 10:00pm CET Time control stopped working. There is new new time in the "Run At" field, although the script should run every 5 minutes. We had the same problem in September, see https://de.mathworks.com/matlabcentral/answers/2184870-thingspeak-timecontrol-stopped-working-at-all?s_tid=srchtitle
Has anybody also prolems with Timecontrol?
The new installer streamlines the process of installing and setting up agentic workflow with MATLAB. If you have been intimidated by the setup process, give this a try!
https://github.com/matlab/agentic-toolkit-installer
For the past several days I have been experiencing a problem with data visualization on two of my ThingSpeak channels.
The data appears to be uploaded and stored correctly, and new entries are still being added to the channels. However, the visualizations are not working correctly.
The standard Field Charts show only a very small number of data points instead of the normal continuous measurements. Most of the points are compressed on the left side of the chart, while one or a few points appear far to the right and are connected by long straight lines. The time axis is also incorrect and sometimes shows repeated dates such as “01 Jan”.
The numeric widgets are affected as well and display incorrect values. Some custom visualizations also remain blank or fail to load.
The problem appeared suddenly and affects two separate channels which had previously been working correctly. I did not make any significant changes to the channels before the problem started.
This seems somewhat similar to the ThingSpeak chart/timeline issue reported in June 2026, when charts were displaying incorrect time ranges and the DAYS/RESULTS settings were not working correctly. However, my current problem also affects numeric widgets and custom visualizations, and the charts show incorrect dates and strangely positioned data points.
Could this be a regression or a similar issue with the ThingSpeak visualization system?
Has anyone else experienced the same problem recently?

About Discussions

Discussions is a user-focused forum for the conversations that happen outside of any particular product or project.

Get to know your peers while sharing all the tricks you've learned, ideas you've had, or even your latest vacation photos. Discussions is where MATLAB users connect!

More Community Areas

MATLAB Answers

Ask & Answer questions about MATLAB & Simulink!

File Exchange

Download or contribute user-submitted code!

Cody

Solve problem groups, learn MATLAB & earn badges!

Blogs

Get the inside view on MATLAB and Simulink!

AI Chat Playground

Use AI to generate initial draft MATLAB code, and answer questions!