Asked by Ned Gulley
on 2 Feb 2011

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?

Answer by Doug Hull
on 2 Feb 2011

Accepted Answer

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.

imread('myImage.jpg')

will error on our machines.

imread('trees.tif')

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)

Andrew Newell
on 7 Feb 2011

However, "Thanks in advance" is silly.

Andrew Newell
on 7 Feb 2011

Walter Roberson
on 7 Feb 2011

trees.tif is included with the basic Matlab distribution.

Sign in to comment.

Answer by Loginatorist
on 2 Feb 2011

Things I like to see in a question:

- 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).
- Example input data which is: A. Short. B. Concise. C. Covers cases (NaN's, zeros, Infs, dimensions) present in real data.
- Expected output data corresponding to input data given in #2
- All error messages and/or received output (as differentiated from expected output) is given.
- A descriptive subject line!

Sign in to comment.

Answer by 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: http://matlab.wikia.com/wiki/FAQ 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.

Sign in to comment.

Answer by jiro
on 2 Feb 2011

- Read "About MATLAB Answers" page.
- 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.
- In the problem description, include as much detail as possible. Describe what you have done so far, including any code snippets if available.
- 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.
- Include screenshots, hyperlinks, and formatting to make your question easy to understand. Read this page for markup syntax.
- 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".
- Accept the answer you found most useful, so that others who have a similar question will know which one worked.
- Do not say "URGENT!! HELP!!" in the subject line. Those questions tend to get the least amount of attention.

Sign in to comment.

Answer by 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.

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 5 Comments

## Oleg Komarov (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/728-how-do-i-write-a-good-question-for-matlab-answers#comment_1096

## Jan (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/728-how-do-i-write-a-good-question-for-matlab-answers#comment_1099

## Doug Hull (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/728-how-do-i-write-a-good-question-for-matlab-answers#comment_1101

## Ned Gulley (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/728-how-do-i-write-a-good-question-for-matlab-answers#comment_1115

## John (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/728-how-do-i-write-a-good-question-for-matlab-answers#comment_296649

Sign in to comment.