MATLAB Answers

How do I write a good question for MATLAB Answers?

45 views (last 30 days)
Ned Gulley
Ned Gulley on 2 Feb 2011
Commented: John on 7 Jul 2015
I want to get fast and accurate help with my question. What information should I include in the question?
How should I phrase and format my question to make it clear and easy to understand for the people who might help me?
John on 7 Jul 2015
Letting us know how proficient with MATLAB would be helpful. If you let us know you are a beginner than it helps the answer writer tailor a response that would make sense to a beginner, which would make it less likely for the question asker to reply back to an answer for clarification. That happens a lot in the MATLAB Answers forum.

Sign in to comment.

Accepted Answer

Doug Hull
Doug Hull on 2 Feb 2011
1.) A good title
If you are writing code about a medical procedure like Brain Salad Surgery but getting an error related to indexing, your question is about indexing. References to Brain Salad Surgery is just noise (like it is here!)
2.) Avoid pleasantries
"Hi", "Thanks in Advance", "I am new to MATLAB" is all just pleasantries that add nothing but noise. It is more polite to be brief than it is to add pleasantries.
3.) MATLAB is the product
MatLab, mat lab, mathlab are all distracting and confuse Google.
4.) Make code copy pastable to reproduce
If it makes sense, we should be able to grab your code block, paste it into MATLAB and reproduce your error.
will error on our machines.
will work on our machines. Try and make it easy for us to help you.
5.) Be brief.
If you can cut your code down relentlessly to just a few lines that cause the error, we can help you better. Cutting out code that is not relevant to the issue simplifies things. Often the act of simplifying will cause you to find your own error!
6.) EDIT your question to clarify.
Do not answer your own question with clarifications. EDIT the question directly.
7.) Accept best answer, vote up good answers.
Do not answer your own question to thank the answerers. ACCEPT the answer. This is the greatest form of thanks you can give. Acknowledgement as the accepted answer is "Sweet mana from heaven" (a quote from a frequent contributor here)
Walter Roberson
Walter Roberson on 7 Feb 2011
trees.tif is included with the basic Matlab distribution.

Sign in to comment.

More Answers (4)

Matt Fig
Matt Fig on 2 Feb 2011
Things I like to see in a question:
  1. Clear explanation of the problem, current code included. If the current code doesn't work, a description of HOW it doesn't work is given. (See #4 below).
  2. Example input data which is: A. Short. B. Concise. C. Covers cases (NaN's, zeros, Infs, dimensions) present in real data.
  3. Expected output data corresponding to input data given in #2
  4. All error messages and/or received output (as differentiated from expected output) is given.
  5. A descriptive subject line!

Jan on 2 Feb 2011
Dear Ned, You gave an excellent example of how to write a good question already:
1. Use a short and descriptive subject. Avoid general formulations like "I need help", "My Matlab function does not work" and "Plz urgent plz".
2. The body of the question should include the minimal number of needed information, but not less. Explain the data available as input and the wanted result (here: "I want get fast and accurate help"). The best method to specify the input data is to show the Matlab function used to obtain it, or some code to create test data. Bad example: "I have an Excel file...". Then it is impossible to predict, if the user knows how to call XLSREAD already, or not. "I want a nice picture" is too vague to lead to matching answers also.
3. Describe the available toolboxes, Matlab and OS-versions, if they concerns the problem. These details do not waste a lot of space: "Matlab 2009a, WinXP, Toolboxes: Signal-Processing, Spline, Financial" - just a line, but might be helpful. E.g. the appearence of GUI elements is often affected by the OS, so mention it. BUT: The question of this thread does not concern any hardware and software details, so such information wastes the readers time.
4. Be aware, that you are very familiar with your problem, but the readers are not. So write your message, relax, and read it again: Is it possible for others to understand each sentence? Bad examples: "I've tried it with a lot of different approaches - nothing worked". Neither the first nor the second part can be reconsidered by others. Concentrate on what you are searching for: one single efficient solution. Therefore write: "I have tried this: [your code] and this problem occurred: [full error message]/[description of results and difference to expectations]".
5. If you can insert a descriptive picture, do it. A handmade drawing can save 1000 words. Use the advantage, that MATLAB Answers is not a newsgroup!
6. If you have problems with a specific command, read the HELP and DOC - twice. If the questions concerns the absolute basics, read the "Getting Started" chapters of Matlab's documentations. Read the FAQ also: It is even worth to read it before a problem appears: It contains a list of "frequently asked questions", so most likely these questions will appear in your life also. If the answers are: "read the help", "read the doc" or "read the FAQ" think about deleting your question.
7. Although it is valuable to follow such advices, it is a very common phenomenon, that a question is solved already, if the inputs, the methods and the outputs are exactly defined. So if your question is incomplete, trust in the further inquiries of the readers and answer them. In the first 12 hours after postin look frequently for the questions of people who try to assist you to improve the question until an exact and efficient answer is possible.
8. Either mark the accepted answer or post the working solution, such that other can profit from the discussion also.

jiro on 2 Feb 2011
  1. Read "About MATLAB Answers" page.
  2. The subject line should be very specific and related to a programming concept (in MATLAB and related products). The scope should not be too broad. For example, "How do I model the human brain using MATLAB and Simulink?" will not get you any answers.
  3. In the problem description, include as much detail as possible. Describe what you have done so far, including any code snippets if available.
  4. If there is a specific error you're seeing in your code, strip down your code to the smallest subset that would reproduce your error, and include that in the question. It would be great to include some sample data so that others can run the code.
  5. Include screenshots, hyperlinks, and formatting to make your question easy to understand. Read this page for markup syntax.
  6. Use "Comment on this Question" or "Comment on this Answer" to thank the poster or ask follow up questions. Do not ask as another "Answer".
  7. Accept the answer you found most useful, so that others who have a similar question will know which one worked.
  8. Do not say "URGENT!! HELP!!" in the subject line. Those questions tend to get the least amount of attention.

Jan on 26 Jun 2011
Do not forget to ask a question!
Several users have posted a general description of what they are doing or planning to do. Of course an experienced member of this forum can sometimes guess, what the actual question might be. But this is not an efficient method to solve problems.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!