General

General

Public Channel

David
David
最後のアクティビティ: 2024 年 7 月 15 日

Hello and a warm welcome to all! We're thrilled to have you visit our community. MATLAB Central is a place for learning, sharing, and connecting with others who share your passion for MATLAB and Simulink. To ensure you have the best experience, here are some tips to get you started:
  1. Read the Community Guidelines: Understanding our community standards is crucial. Please take a moment to familiarize yourself with them. Keep in mind that posts not adhering to these guidelines may be flagged by moderators or other community members.
  2. Ask Technical Questions at MATLAB Answers: If you have questions related to MathWorks products, head over to MATLAB Answers (new question form - Ask the community). It's the go-to spot for technical inquiries, with responses often provided within an hour, depending on the complexity of the question and volunteer availability. To increase your chances of a speedy reply, check out our tips on how to craft a good question (link to post on asking good questions).
  3. Choosing the Right Channel: We offer a variety of discussion channels tailored to different contexts. Select the one that best fits your post. If you're unsure, the General channel is always a safe bet. If you feel there's a need for a new channel, we encourage you to suggest it in the Ideas channel.
  4. Reporting Issues: If you encounter posts that violate our guidelines, please use the 🚩Flag/Report feature (found in the 3-dot menu) to bring them to our attention.
  5. Quality Control: We strive to maintain a high standard of discussion. Accounts that post spam or too much nonsense may be subject to moderation, which can include temporary suspensions or permanent bans.
  6. Share Your Ideas: Your feedback is invaluable. If you have suggestions on how we can improve the community or MathWorks products, the Ideas channel is the perfect place to voice your thoughts.
Enjoy yourself and have fun! We're committed to fostering a supportive and educational environment. Dive into discussions, share your expertise, and grow your knowledge. We're excited to see what you'll contribute to the community!
My fourth entry, Big Wave (entry 16646), drops you on a breaking wave at sunset. Your surfer carves up and down the face on their own. You tap at the bottom of each turn to pump for speed, stay ahead of the curl chasing you, and launch airs off the lip when your board turns gold.
Real frames from the game: the title screen, a pump, an air, and riding inside the barrel for triple points.
As with my other entries, I built it with help from an AI coding assistant (Claude Code) and tested every change in MATLAB. This one took four playtests to get right, and most of what I learned came from the ones that didn't work.
1. One button is a timing game, not a tapping game
The wave looked good from the first version. The gameplay didn't.
  • Version 1: tapping switched the surfer between climbing and dropping. My playtest verdict: it played like Flappy Bird, where you keep pressing until something happens.
  • Version 2: two lines, high and low, with rocks and breaking lips to dodge and a camera that swung around to look ahead. It was worse. The hazards were hard to read, the new camera lost the barrel view, and it still wasn't fun.
  • Version 3: the surfer carves by themselves, and you only tap to pump at the bottom of a turn. The closer to the exact bottom, the more speed you get. A tap at any other moment bogs the board down and costs a quarter of your speed, so mashing is punished.
Two later changes made version 3 work. First, every turn now has a random length, so you watch the turn instead of tapping to a beat. Second, the cue moved from a ring on the surfer, which got lost in the scene, to a fixed gauge on the right: a white dot rides a column of dots, green at the bottom for a pump and gold at the top when you can fly.
To check that skill matters, I ran bots through the final version. Idling and spamming die within seconds, and only good timing keeps you alive:
Median of 8 runs per bot. Going for airs scores about 2.5 times more than playing safe, but it dies sooner. That trade-off is the choice I wanted.
Bots can't tell you whether something is fun, but they do catch the worst designs before a playtest.2. A breaking wave from three keyframes and one matrix product
The wave is a single surf. Each slice across it is a cross-section with 13 control points, blended from three keyframes: an open face, a curling barrel, and collapsed whitewater. The blend depends on how far that slice is from the curl, so the wave throws a barrel just ahead of the curl and turns to foam behind it.
The useful trick is that a cubic spline is linear in its data. Interpolating the identity matrix once gives a matrix that splines any set of control points:
t = [1:.5:3.5 linspace(4,12,30) 12.5 13]; % where to sample the curve
S = spline(1:13,eye(13),t)'; % 40 x 13 spline matrix, built once
Each frame, the control points for all 64 slices are a weighted mix of the keyframes, and S*CX smooths every slice in one matrix product. There are no loops and no spline calls per frame.3. A 24 x 28 sprite in 112 characters
The surfer started as a stick figure. I wanted a proper silhouette, but imread is banned and the entry has to be a single file, so I drew the sprite from thick limb segments in a helper script and packed it into the code as text. Each character stores 6 pixels:
c = dec2bin(double('0000003P407`?07`7P7`...')-48,6)'; % 112 chars -> 672 bits
[j,i] = find(reshape(c-48,24,28)); % filled pixels
px = [j-12 28.5-i]'*.07; % pixel offsets in metres
The pixels are drawn as one scatter3 of square markers. They're placed in the camera's screen plane, so the sprite always faces you, and a 2-by-2 rotation leans it into each carve and flips it during an air:
o = .2*sin(s.ph)+2*pi*a/.9*(s.air > 0);
body = P+[r' u']*[cos(o) -sin(o);sin(o) cos(o)]*px; % r, u: screen right and up
As a bonus, the scatter sprite rendered faster than the old stick figure. Frame time dropped from about 40 ms to 15 ms on my PC.4. A HUD that stays put in a 3D scene
Waves grow as you progress, so the camera position and target are both multiplied by the wave height H. Anything else placed at H times a fixed point therefore stays at the same spot on screen. The gauge uses this: its dots sit a little in front of the camera, offset along the screen's right and up vectors, and never move however big the wave gets:
c = [3 1.6 .3]; f = [.3 -1.2 .45]-c; f = f/norm(f); % camera position and view direction
r = cross(f,[0 0 1]); u = cross(r,f); % screen right and up
P = H*(c+f+.5*r-.3*u+g*.17*u); % g: each dot's place on the gauge
The same right and up vectors stand the sprite upright.5. Squeezing in the last characters
The final file counts exactly 10,000 of 10,000 characters. The counter reformats your code first, so comments are free but every space around a comma or operator counts, as I described in my first post. Long lists of numbers are expensive for that reason, so:
  • Pack number tables as strings. The keyframe control points are multiples of 0.05, so each one fits in a single character:x = reshape(double('\\`YMZVCUTHPQRKNZFIW>00(')/20-4.6,3,8);
  • Swap an FFT ocean for a dozen sine waves. My first version had a full Tessendorf FFT ocean for the small chop. Twelve sine wave trains, each moving at its own deep-water speed sqrt(9.81*k), look nearly the same at this scale and cost far fewer characters.
  • Use deal to reset state. [s.ys,s.pts,s.air,s.dead] = deal(0); resets many fields in one statement.
  • Find a short path for the colour. One scalar colour index through a custom colormap (haze, deep blue, backlit aqua, foam) was shorter and about twice as fast as a full RGB CData.
Play it
If MATLAB Online is slow for you, run it in desktop MATLAB: download the starter project, copy the entry's code into game.m, and run minihackContest.play.
How long can you outrun the curl?
Toshiaki Takeuchi
Toshiaki Takeuchi
最後のアクティビティ: 2026 年 11 月 17 日 14:16

Earlier this year a bunch of MATLAB users got together to talk about their hobbies in a lightning talk format.
  • Using "UIHTML" to create app components and Lightning
  • Creating generative art with MATLAB
  • Making MATLAB run on the Steam Deck (it was a wager)
Do you use MATLAB for hobbies?
Jorge Paloschi
Jorge Paloschi
最後のアクティビティ: 2026 年 11 月 12 日 13:49

I am unable to submit an entry for the One Button contest using the supplied minihackContest.submit function. I keep getting the error "Submission failed: HTTP 500 Something went wrong. Please try again in a moment.". It happens to me both in a MATLAB session as well as on a MATLAB Online session. No idea what I am doing wrong...
happy
happy
最後のアクティビティ: 2026 年 11 月 11 日 23:18

Currently, MathWorks provides free access to MATLAB Online for anyone with a personal account. Each account receives 20 hours of usage per month and includes access to the following 10 toolboxes:
  • Control System Toolbox(控制系统工具箱)
  • Curve Fitting Toolbox(曲线拟合工具箱)
  • Deep Learning Toolbox(深度学习工具箱)
  • Image Processing Toolbox(图像处理工具箱)
  • Optimization Toolbox(优化工具箱)
  • Signal Processing Toolbox(信号处理工具箱)
  • Statistics and Machine Learning Toolbox(统计与机器学习工具箱)
  • Symbolic Math Toolbox(符号数学工具箱)
  • Text Analytics Toolbox(文本分析工具箱)
I would like to know whether it is possible to customise the selection of these 10 toolboxes. For example, I mainly work in computer vision, but Computer Vision Toolbox is not included in the current offering, which is quite disappointing because I cannot use it.
At the same time, several of the included toolboxes are not useful for my work, such as Control System Toolbox and Signal Processing Toolbox. Therefore, it would be great if users could choose the toolboxes that best fit their needs rather than being limited to a fixed set of toolboxes.
Chen Lin
Chen Lin
最後のアクティビティ: 2026 年 11 月 5 日 19:45

We heard your feedback that it can be difficult to find the latest comment or reply in long threads. To make this easier, you can now jump directly to the latest activity by clicking the latest activity date link at the top of the leaf page. See the screenshot below for an example. This is similar to the experience of MATLAB Answers today.
Thanks again for sharing your feedback and helping us improve the experience.
Urs
Urs
最後のアクティビティ: 2026 年 11 月 5 日 12:32

I have been using MATLAB on a daily basis for more than 30 years. For the past few months, I have been working with version 2026, and the problems I have encountered are staggering, especially when debugging functions.
The issues started to appear gradually with R2026a. Suddenly, the cursor would disappear, copy and paste would stop working, and MATLAB often had to be restarted because of these issues. In addition, the new figure UI is painfully slow, and entering debug mode has become frustrating. When stepping through code, MATLAB can take several seconds to respond to a debugging command such as Step.
Today, I finally got fed up and reinstalled R2024b. It works perfectly fine.
Matt Nickels
Matt Nickels
最後のアクティビティ: 2026 年 11 月 4 日 1:58

I can not understand why Plot Browser was taken away in latest Matlab... I use Plot Browser all of the time! Having to find and click the particular line I want in a plot with a lot of lines is way less convenient than just selecting it in the Plot Browser. Also, being able to quickly hide/show multiple lines at once with the plot browser was so helpful in a lot of cases. Please bring Plot Browser back!!!! Please reply with support for this if you feel the same as I do!
Walter Roberson
Walter Roberson
最後のアクティビティ: 2026 年 11 月 2 日 18:17

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
HDFql
HDFql
最後のアクティビティ: 2026 年 10 月 25 日 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!
Pooja
Pooja
最後のアクティビティ: 2026 年 10 月 16 日

I am frequently facing issue with the onramp training of not proceeding to the next task or section, even after successfully completion of the current task or complete section.
Stephen23
Stephen23
最後のアクティビティ: 2026 年 10 月 15 日

Many widely cited coding style guides originate from large-scale software engineering contexts: multi-developer teams, large codebases, separate reviewers, tooling-driven workflows, and a focus on completed, delivered code. While those constraints are valid in their domain, they often map poorly onto scientific and engineering scripting as it is often practiced with MATLAB.
In laboratory and engineering environments, code serves a different role. It is frequently written by individuals or small groups, and then iteratively modified, copied, adapted, and extended as part of an evolving problem-solving process. In this context, the primary priorities are not strict stylistic consistency or tooling compatibility or delivery, but rather:
  • maintaining clarity of underlying structure,
  • minimizing the risk of errors during modification, and
  • supporting rapid comprehension of mathematically or logically dense code.
This raises the question: should fixed line-length limits be replaced by context-aware principles? Could these be supported by a suitable AI tool?
The following proposal outlines a small set of heuristics governing line length, based on observations of real-world MATLAB usage, particularly for numerically intensive and structurally rich code. These heuristics aim to:
  • preserve and expose meaningful structure (e.g. systems of equations, tables, repeated patterns)
  • avoid formatting that obscures relationships or introduces errors, and
  • treat different kinds of code (logic vs. data vs. structured expressions) appropriately.
Scope
These principles apply to scientific and engineering scripting, particularly:
  • MATLAB-like environments
  • numerically or structurally dense code
  • monolithic or semi-monolithic workflows
  • code that is frequently modified, copied, and adapted
They are not intended for large-scale commercial software engineering, where different constraints dominate.
Core Objective
Line length and formatting should maximize comprehension, structural clarity, and correctness under modification, rather than enforce arbitrary limits.
Hierarchy of Heuristics
Higher-numbered heuristics take precedence over lower-numbered ones.
1) Reasonable Line Length
Code intended for reading should use a reasonable line length, guided by:
  • human visual comprehension when scanning
  • clarity of expression
  • preservation of logical units
This would tend toward 70-100 characters per line, depending on the density.
2) Preserve Semantic Integrity of Lines
Line breaks must not split code in ways that degrade understanding.
Avoid:
  • dangling fragments
  • very short continuation lines
  • separation of tightly coupled elements
  • etc.
Prefer:
  • keeping logically cohesive expressions intact
  • breaking only at clear structural boundaries
One slightly longer line is preferable to two poorly structured lines.
3) Treat Data as Data (Not Prose/Code)
Code that primarily represents data rather than logic is not intended for sequential reading.
This includes:
  • large numeric vectors
  • lookup tables
  • pasted datasets
  • etc.
Such code:
  • may exceed line length limits without restriction
  • should prioritize density and structural stability
  • should minimize its vertical real-estate
  • is assumed to be accessed via search or indexing rather than visual parsing
Readability of data as code is not the objective; retrievability and integrity are. Yes, this intentionally rejects the enterprise rule that data must be separate from code, instead the IDE should support workflows that some real-world users actually employ, for example by displaying embedded data differently.
4) Preserve and Expose 2D Structure
If code encodes a logical, mathematical, or tabular structure with inherent spatial relationships, it should be represented accordingly.
This includes:
  • systems of equations
  • tabulated data
  • repeated structured expressions
  • etc.
Requirements:
  • alignment should be used where it improves comprehension
  • patterns should be visually apparent
  • deviations from patterns should be easily detectable
This principle should be applied strongly, tending toward mandatory use where feasible.
Exception
If a structure would become impractically wide, a compromise representation may be used.
Breaking meaningful spatial structure is considered harmful to comprehension and correctness.
5) Preserve Structural Consistency Across Similar Code
Code segments representing similar or related logic should be expressed in consistent structure and layout.
This applies to:
  • repeated formulas
  • analogous computations
  • structurally similar transformations
  • etc.
Consistency enables:
  • rapid comparison
  • detection of inconsistencies
  • safer modification
Similar logic should be represented in similar ways.
Meta-Principles
A. Structure Over Style
Line lengths should reflect the underlying structure of the problem, not conform to arbitrary limits.
B. Correctness Over Convention
Avoid line lengths and formatting that:
  • obscures patterns
  • hides inconsistencies
  • increases the risk of modification errors
C. Optimize for Modification
Code in this domain is frequently:
  • edited
  • duplicated
  • extended
  • adapted by changing parameters, values, or datasets
  • commented out for testing different versions
  • etc.
Line lengths should reduce the likelihood of errors during these operations, for example by keeping atomic concepts on the same line rather than splitting them up.
D. Anomaly Visibility
Formatting should make unexpected deviations immediately visible.
E. Tool Support
An intelligent tool should:
  • respect and preserve structural layout
  • avoid rigid line-length enforcement
  • detect patterns and inconsistencies
  • assist rather than constrain the programmer
This is not a request for explanations of how scientific users can comply with enterprise software-engineering practices (I am quite aware of those practices). Instead, this thread suggests that those tools and practices could be redesigned around the characteristics of scientific work. I would be interested to hear how well these ideas match others’ experience, particularly in scientific or engineering workflows.
See also:
Paul
Paul
最後のアクティビティ: 2026 年 10 月 13 日

The Ran In tag still shows R2026a on Answers and Discussions (as does the Executing In popup), even though both are actually running R2026b.
This seems to be always be an issue whenver the site updates to the latest release. Seems like it should be pretty straightforward to update those message at the same time the underlying release is updated. Or am I underestimating the complexity of that task?
matlabRelease
ans =
matlabRelease with properties: Release: "R2026b" Stage: "release" Update: 0 Date: 08-Sep-2026
Suraj
Suraj
最後のアクティビティ: 2026 年 10 月 12 日

What if MATLAB could show you not only the final output, but also how your code reaches that result?
Imagine an interactive tool that visualizes variable changes, function calls, matrix transformations, and execution flow as a program runs. Engineers could watch algorithms evolve, identify unexpected behavior, and understand complex simulations through live visualizations.
The idea is to build a Live MATLAB Execution Explorer that combines code tracing, variable timelines, and 3D engineering simulations in one interface.
From debugging control systems to teaching numerical methods, this could transform how students, researchers, and engineers interact with code.
The challenge? Capturing execution data efficiently without significantly affecting performance.
The vision: Turn programming from something we read into something we can see, explore, and understand.
#MATLAB #Simulink #EngineeringInnovation #Simulation #DeveloperTools
Siddharth
Siddharth
最後のアクティビティ: 2026 年 10 月 12 日

I recently had an idea for a side project: building an app/extension that can interactively follow simulations and visualise the live flow of code execution.
For this, I would need access to variables, datasets, and the function call stack during execution, ideally without interfering with the actual code execution.
However, I found that MATLAB's current architecture makes this difficult, as the entire application runs in a single thread and there are no publicly exposed APIs to access runtime variables without interrupting execution.
Can anyone suggest a possible workaround or an alternative approach to achieve this?
To develop uifigure-based app, I wish MATLAB can provide something like uiquestdlg to replace questdlg without changing too much of the original code developed for figure-based app. Also, uiinputdlg <-> inputdlg and so on.
Dan Dolan
Dan Dolan
最後のアクティビティ: 2026 年 10 月 8 日

Extremely--I have real work to do
24%
Maybe talk about something else?
24%
Neutral
24%
Not very much
24%
Let's talk about nothing else
5%
21 票
Suraj
Suraj
最後のアクティビティ: 2026 年 10 月 4 日

I keep forgetting the functions and lack of pratices would be the reason
Siddharth
Siddharth
最後のアクティビティ: 2026 年 10 月 4 日

I recently had an idea for a side project: building an app/extension that can interactively follow simulations and visualise the live flow of code execution.
For this, I would need access to variables, datasets, and the function call stack during execution, ideally without interfering with the actual code execution.
However, I found that MATLAB's current architecture makes this difficult, as the entire application runs in a single thread and there are no publicly exposed APIs to access runtime variables without interrupting execution.
Can anyone suggest a possible workaround or an alternative approach to achieve this?
Hello everyone
After you read the blog post about all the new goodness in MATLAB 2026b I am sure you'll rush out to install it. If you do one more thing, however, I suggest that you install this add-on from MATLAB File-Exchange since it will make object-oriented code much faster.
"How much faster?" I hear you ask. This much faster:
If you prefer numbers to pictures, all of the details are in a blog post from when we released the limited beta: Objects are about to get much faster in MATLAB » The MATLAB Blog - MATLAB & Simulink
"Why didn't we make this the default?" I hear you ponder. Because there is a small chance that the new system will break your code. It's a very small chance and I've personally not seen any code that does get broken. However, such code does exist and we want to be give you the chance to discover this and work with us to make your code compatibile before it does become the default.
I hope you enjoy using 2026b as much as we enjoyed making it.
Cheers,
Mike

General について

Discuss a wide range of MATLAB topics and share your thoughts and opinions with other community members.

This is the channel to post to if your topic doesn't fit any other channel contexts.

All technical questions
Community Guidelines MATLAB FAQs

上位コントリビューター