General

General

Public Channel

David
David
Last activity on 15 Jul 2024

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!
Pooja
Pooja
Last activity about 7 hours ago

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
Last activity on 15 Oct 2026 at 8:51

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
Last activity on 13 Oct 2026 at 16:31

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
Last activity on 12 Oct 2026 at 10:13

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
Last activity on 12 Oct 2026 at 10:06

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
Last activity on 8 Oct 2026 at 19:04

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 votes
I keep forgetting the functions and lack of pratices would be the reason
Siddharth
Siddharth
Last activity on 4 Oct 2026 at 7:10

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
Hi everyone
Some of my colleauges at MathWorks are conducting a survey on how people use science and engineering file formats such as NetCDF, HDF5, Zarr and so on.
It will only take a few minutes to fill out and is completely anonymous unless you want to be contacted. Your thoughts, details of usage in your domain or industry, and current friction points will help us improve MATLAB to better support the kind of work you do in the future!
If there's anything not covered by the survey that you'd like to mention, feel free to reply to this thread.
Cheers,
Mike
Zhaoxu Liu / slandarer
Zhaoxu Liu / slandarer
Last activity on 21 Sep 2026 at 12:39

All these examples are plotted using SHeatmap. For details, please refer to the relevant examples in the demo_SColorbar folder included in the toolbox.
TokaLab is an open-access virtual tokamak platform built in MATLAB for nuclear fusion modeling, diagnostics, inverse problems, and computational experimentation.
This September, v1.3 was published on GitHub with a set of new features
  1. App installer for MATLAB Online — run TokaLab directly in your browser.
  2. Two new tutorials covering the core modules, SimPla and SynDiag, in detail.
  3. Two new modules: TokaPlot for advanced plotting, and SynRad for radiation generation.
  4. Real tokamak geometries, supporting more realistic tokamak modeling.
Black
Black
Last activity on 31 Aug 2026

You can use MATLAB's rat() function to obtain a rational approximation of a decimal value. For example, rat(0.625) gives a representation equivalent to 5/8. If you simply want to verify decimal/fraction conversions without running MATLAB, a browser-based decimal-to-fraction calculator can also be useful.
goc3
goc3
Last activity on 31 Aug 2026

Very Favorable
21%
Favorable
22%
Neutral
20%
Unfavorable
17%
Very Unfavorable
20%
886 votes
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.
"As of January 1, 2026, Perpetual Student and Home offerings have been sunset and replaced with new Annual Subscription Student and Home offerings."
So, Perpetual licenses for Student and Home versions are no more. Also, the ability for Student and Home to license just MATLAB by itself has been removed.
The new offering for Students is $US119 per year with no possibility of renewing through a Software Maintenance Service type offering. That $US119 covers the Student Suite of MATLAB and Simulink and 11 other toolboxes. Before, the perpetual license was $US99... and was a perpetual license, so if (for example) you bought it in second year you could use it in third and fourth year for no additional cost. $US99 once, or $US99 + $US35*2 = $US169 (if you took SMS for 2 years) has now been replaced by $US119 * 3 = $US357 (assuming 3 years use.)
The new offering for Home is $US165 per year for the Suite (MATLAB + 12 common toolboxes.) This is a less expensive than the previous $US150 + $US49 per toolbox if you had a use for those toolboxes . Except the previous price was a perpetual license. It seems to me to be more likely that Home users would have a use for the license for extended periods, compared to the Student license (Student licenses were perpetual licenses but were only valid while you were enrolled in degree granting instituations.)
Unfortunately, I do not presently recall the (former) price for SMS for the Home license. It might be the case that by the time you added up SMS for base MATLAB and the 12 toolboxes, that you were pretty much approaching $US165 per year anyhow... if you needed those toolboxes and were willing to pay for SMS.
But any way you look at it, the price for the Student version has effectively gone way up. I think this is a bad move, that will discourage students from purchasing MATLAB in any given year, unless they need it for courses. No (well, not much) more students buying MATLAB with the intent to explore it, knowing that it would still be available to them when it came time for their courses.
💡About
First, I would like to thank everyone who has downloaded my eds-classification repository so far. This post is meant for those who are currently using the repository or may be interested in using the repository in their research.
To keep things short, I have released v2.0 of the eds-classification series on GitHub and the File Exchange. The update comes with significant changes to the repository structure and functions, and so it is worth noting that the update will likely be incompatible with any scripts written using prior releases.
The update provides several key new features that are meant to improve usability and producton. If you are interested in seeing how eds-classification may help you with your mineralogy research, please check out the release notes for v2 and consider giving the repository a try.
Respectfully,
Austin
📝Release Notes
The full release notes for v2 are available here: https://github.com/weber1158/eds-classification/releases/tag/v2.0
⬇️Download Now
AI writes all my code now
18%
Multiple times a day
24%
A few times a week
15%
A few times a month
7%
Only for suggestions
22%
It is not allowed for my work
14%
758 votes

About 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