Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 869531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:19:19+00:00 2026-05-15T10:19:19+00:00

When creation a MATLAB exception (MException object) or printing a warning or error message,

  • 0

When creation a MATLAB exception (MException object) or printing a warning or error message, MATLAB lets you supply a message ID that defines the except you’re throwing.

The message ID is in the format:

component:mnemonic

For example, MATLAB’s own undefined variable message ID is:

MATLAB:dispatcher:nameConflict

So when you use exceptions in your own code, what do you use for a message ID? Do you reuse MATLAB’s default ones? Make up your own? What do you use for the component and mnemonic strings?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T10:19:20+00:00Added an answer on May 15, 2026 at 10:19 am

    I generally follow this pattern for error (or warning) message identifiers, where things in parentheses may or may not be present:

    (className):(parentFunction):functionWhereErrorOccurs:descriptiveMnemonic
    

    The components are:

    • className: The name of the class, if the function where the error occurs is a method/constructor.

    • parentFunction: If the function where the error occurs is a subfunction in an m-file or a nested function, this would be the primary m-file function or the parent of the nested function, respectively. You could therefore have multiple parentFunction components.

    • functionWhereErrorOccurs: The name of this component is pretty self-explanatory. 😉

    • descriptiveMnemonic: I stress descriptive. For example inputError doesn’t really tell me anything, but notEnoughInputs makes it clear that I didn’t pass enough arguments. I always use lower camel case for the mnemonic, where the first letter of a word is capitalized except for the very first word.

    The className and parentFunction components could be considered somewhat redundant, since the stack property of the MException class already identifies a complete path to the parent m-file and the line number of the error. However, one of the purposes of a message identifier is that it allows you to uniquely identify an error for purposes other than just hunting down the source of the error.

    Let’s say you have a function myFcn and a class myClass that overloads myFcn. If you make an error message identifier for the first one be myFcn:maxIterationsReached and an error message identifier for the second one be myClass:myFcn:maxIterationsReached, this would allow you to, for example, set a breakpoint with DBSTOP that halts execution only when this error is produced by myClass\myFcn and not myFcn. Likewise, unique warning message identifiers are useful in that you can specifically choose to ignore warnings from specific functions while letting others be displayed.

    Additionally, you could also include components in the identifier indicating that the function where the error occurs is located in a package folder or a private folder (but this might make for a rather long identifier).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It doesn't make any difference to the compiled code. Personally… May 16, 2026 at 2:42 pm
  • Editorial Team
    Editorial Team added an answer Are you assuming that the Rendering event fires at a… May 16, 2026 at 2:42 pm
  • Editorial Team
    Editorial Team added an answer I will refer you to paramiko see this question ssh… May 16, 2026 at 2:42 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm developing an extension to MATLAB's PsychToolbox that allows for better control of the
I know that to receive notifications about Win32 process creation or termination we might
Is there any explanation of the sequence of events that occurs in the creation,
I have a custom routing class that checks versioning of an object to allow
I'm wondering how in MATLAB you can get a reference to a Java enum
I'm writing a simple MATLAB program to solve a project Euler problem. The program
I need a checkbox to be checked by default on creation of the gui.
Creation of objects like tables and indexes are fairly essential, even if the code
On creation of a user, a row must be inserted into both the User
How does the event creation and handling work in Java Swing?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.