Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

TUTORIAL: how to ask a question (on Answers) and get a fast answer

Asked by Oleg Komarov on 25 Apr 2011
Latest activity Edited by Image Analyst on 30 Nov 2013

[ I ] HOW TO ASK QUESTIONS AND GET A FAST ANSWER

1) Before asking, did you search:

2) Post a substantial question in comprehensible english. Be brief, complete and clear (see also points 3-4).

3) Show what you have attempted so far and if you have got:

  • an error then post the whole error message;
  • unwanted results then post a brief example of your inputs and the desired output.

4) Provide standalone and formatted code: how to format your question with markup.

5) Before you click on the submit button, review your question in the preview pane (sometimes you need to "refresh")

.

How to thank people who helped you:

6) If (and only if) one of the answers is the solution for your problem do accept it and say thank you.

7) Vote on the best answers.

8) Do not accept your own answer unless it is the complete/detailed solution and you formulated it independently.

--------------------------------------------------------------------------------------------------------------------------------------

[ II ] EXAMPLES:

[EX1] - How can I speed up this loop?

A = [];
for ii = 1:10
   A = [A ii];
end

[EX2] - I get an error, what's wrong?

>> foo
??? Subscript indices must either be real positive integers or logicals.
Error in ==> foo at 5
B(loc)

This is the function:

function foo
A = 1:10;
B = 0:1;
[tf, loc] = ismember(A,B);
B(loc)

--------------------------------------------------------------------------------------------------------------------------------------

[ III ] DON'Ts:

All of the following points are addressed in section [I] or by common sense.

  • use demanding or commanding tone
  • ask for ready to use code
  • ask to solve your homework
  • use URGENT in any part of your post and why your post is NOT urgent.
  • use HEEELP, MATLAB, PLEASE in your title. Use a meaningful title.
  • post your code in the comments. Edit your original question adding formatted code.
  • post duplicate questions.
  • post multiple answers on the same thread (don't rely on chronological order of answers then). Use comments.

--------------------------------------------------------------------------------------------------------------------------------------

[ IV ] HOW DO I KNOW IF I ASKED THE QUESTION CORRECTLY

  • You got a quick answer which solved your problem

Otherwise:

  • some of the DON'Ts apply to your post
  • you have been asked to post more details
  • you have been tagged with: doit4me, givemecode, homework, assignment, no attempt, sendit2me etc... For a detailed description of the purpose and use of tags see: a guide to tags.
  • you have got no feedback at all

-------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------

[AKNOWLEDGMENTS]

In alphabetical order by nickname, thanks for their suggestions to:

Andrew Newell, Andy, Jan Simon, Jiro Doke, Matt Fig, Matt Tearle, Paulo Silva, Randy Souza, Rick Rosson, Sean de and Walter Roberson

[LOG]

Edits to enhance visibility of the post will not be recorded.

  • ...................... - created
  • 06 Aug 2011, 11:17 BST - added log
  • 07 Aug 2011, 00:05 BST - added tutorial series section
  • 08 Aug 2011, 06:16 BST - added other links section and changed links in section [I.4]
  • 18 Aug 2011, 01:44 BST - minor edits
  • 04 Sep 2011, 12:16 BST - [I.5] into [I.1] + reordered; new [I.5]; minor edits
  • 10 dec 2011, 19:09 GMT - minor edits to [I.2] and [III]
  • 20 Feb 2012, 14:38 GMT - added "refresh" suggestion to [I.5]
  • 22 Feb 2012, 17:30 GMT - edited [III], why your post is NOT urgent
  • 05 Jun 2012, 14:44 BST - Added link to MathWorks Documentation Center (Beta)
  • 02 Aug 2012, 19:34 BST - Added link to "A guide to tags" in [IV] and [OTHER Links]
  • 15 Oct 2012, 15:30 BST - Substituted link to Beta documentation (now adopted) with docs for Previous releases

[TUTORIAL Series]

[OTHER LINKS]

-------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------

Please, suggestions are welcome.

Vote on Wish-list for MATLAB Answer sections my post if you think that a tutorial section on top of Answers could be useful.

12 Comments

Walter Roberson on 13 Jul 2011

Multiple answers on the same thread may be appropriate if each answer uses a different mechanism or addresses a different possible interpretation of the question.

Oleg Komarov on 14 Jul 2011

@Walter: somehow I missed your previous comment with the direct link. I modified accordingly.
The second comment is more related to the contributor's code of conduct.

Adrian on 30 Nov 2013

thanks for advices

Oleg Komarov

Products

No products are associated with this question.

12 Answers

Answer by Andy on 16 May 2011

Do:

  • Check the FAQ.
  • Google search.
  • Make use of lookfor, doc, and help commands.
  • Try out simple code snippets yourself rather than asking about them.

Don't:

  • Ask questions about an answer by entering another answer. (Use the "comment" feature. That's what it's there for. Answers will change order over time. Comments will not.)

7 Comments

Oleg Komarov on 17 May 2011

@Jan will definitely consider it!

Walter Roberson on 18 May 2011

jfgi and lmgtfy are not recommended.

Andrew Newell on 20 May 2011

Occasionally I suggest a search string for Google - as a comment, since it's not really worth submitting as an answer.

Andy
Answer by Rick Rosson on 26 Aug 2011

DO:

  • Please include which release of MATLAB you are using, e.g. R12, R14, R2008b, R2011a, etc.
  • Please make sure it is clear which platform you are using, e.g. MATLAB, Simulink, Stateflow, SimEvents, SimScape, etc.
  • Please format your question and especially any code that you include. If you don't know how, please refer to Markup Help.
  • Please review your question in the Preview pane before you click on the Submit button. Check for spelling mistakes, typos, grammatical errors, formatting, and especially clarity. Put yourself in the shoes of someone who might try to answer your question. Did you make it easy or hard for them to answer your question?
  • Please review your question after you click on the Submit button. If you find any errors, omissions, or problems, please click on the Edit link and make the necessary corrections.
  • If you are satisfied with an answer, please let the person who posted that answer know so that he/she does not wonder whether it helped or not. Please Accept the answer and add a comment thanking the person for helping you.
  • If you are not satisfied with any of the answers to your question, please consider revising, clarifying, or adding more details to your question.

DO NOT:

  • Please do not write a thesis or novel to explain the issue. Be concise. Enough said.
  • Please do not leave us guessing. Make sure you include enough information so that we can reproduce the issue ourselves in MATLAB or Simulink.
  • Please do not include ambiguous descriptions of the issue. Say what you mean, and mean what you say.
  • Please do not Accept an answer unless you are completely satisfied that it solves the issue raised by your question.
  • Please do not ask us to do your homework for you.
  • Please do not complain if no one answers your question right away. It is often (though not always) because you did not follow the advice in this tutorial.

0 Comments

Rick Rosson
Answer by Matt Tearle on 5 May 2011

Do (if possible):

  • Give examples.
  • Provide standalone code. If not possible, give a thorough explanation of what the missing parts do/look like.

Eg:

  • "How can I sort a vector according to values in another vector? For example if A = [5 2 7 4] & B = [0 6 2 3], I want the "sorted" B to be [6 3 0 2]"
  • "Here's my code. The load command on line 7 loads foo which is a 5-by-42 matrix of numbers between 0 and pi."

1 Comment

Image Analyst on 29 Nov 2013

Providing standalone code means attaching, with the paper clip icon , all the files necessary to run your program. This means the m-file, the data file, mat file, or image file (if you're using one), and the fig file if you're using GUIDE. We can't run your program if any of those files are needed but not supplied.

If your program is long, attach it , don't paste a 500 line long program into the code editor!

Matt Tearle
Answer by Andrew Newell on 15 May 2011

Don't:

  • Post duplicate questions.

If you feel that your question has been neglected, it may be because you didn't pay attention to the Do's. Try clarifying or adding more detail. This will have the added benefit of bumping your question back to the top of the queue.

0 Comments

Andrew Newell
Answer by Sean de Wolski on 25 Apr 2011
  • Don't accept the first answer to come up! If an answer works for you THEN accept it. I.e. Don't accept it and then ask for an explanation or say "This doesn't really work!"

0 Comments

Sean de Wolski
Answer by Paulo Silva on 25 Apr 2011
  • Don't accept your own answer unless it's really the correct answer and you posted the detailed solution and/or the code
  • Don't forget to say thank you to those who tried to help you
  • If one of the answers is the solution for your problem do accept it and say thank you (Sean already had mention this one)
  • Vote on the best answers

0 Comments

Paulo Silva
Answer by Walter Roberson on 29 May 2011

Could we get something about the proper use of "urgent" -- and about the dangers of over-using it? "The Boy Who Cried Wolf"

3 Comments

Oleg Komarov on 29 May 2011

It's among the don'ts, if you were thinking to give it more evidence I can put it as the first bullet point.

Jan Simon on 1 Dec 2011

I do not think, that the internal order of the points matters. It would be much more important to add a link to this thread in a welcome mail for new users.

Julián Francisco on 17 Dec 2011

I think this thread should be included in some section of Matlab Answers for consult.

Walter Roberson
Answer by Walter Roberson on 11 Aug 2011

Do: post the relevant parts of your actual code, or a test-case that has been found to exhibit the same problem. If you leave any variables undefined in your code, describe their datatype and size.

Do not: type in an untested approximation of your code. You will probably make mistakes in variable names or in call syntax miss some details, and then people will end up debugging your typing mistakes instead of debugging your real difficulty,

0 Comments

Walter Roberson
Answer by Walter Roberson on 1 Dec 2011

DO:

Phrase your post as a question.

The question should be more substantial than "How do I do this?" or "What is the code for this?".

DO NOT:

Phrase your post in a way that other people might interpret as a demand or command !!

For example, "Send me the code for..." and "Write a program to..." would be interpreted as demands or commands. Especially "Write a program": that tends to get people upset, and even more upset if it is a homework assignment. This is not a homework-answering service, and the volunteers are here to learn and teach, not to be treated as servants and not to do assignments for people.

Asking "Please send me the code for..." is an improvement, but it still assumes that once someone found the code, that they would take the effort to email it to you (which could be time-consuming and even expensive for them.) Better would be to ask if someone could advise on where you could download the code.

If you must post a homework assignment, then be sure to distinguish your own words from the words of the assignment. Homework assignments should always be accompanied by a description of what you have done so far on the assignment, and a description of what it is that you are stuck on. People will think Bad Things about you if you post a homework assignment without adding your own commentary.

0 Comments

Walter Roberson
Answer by Sean de Wolski on 8 Mar 2012

If you are getting a: Crash/SegV or Java Exception, contact technical support:

http://www.mathworks.com/support/contact_us/index.html

1 Comment

Jan Simon on 8 Mar 2012

I do not completely agree. On one hand the technical support rejects questions from student versions or students, who are using a site license without beeing associated with this license personally.
On the other hand I would add: "... execpt you are writing your own C-mex files - than debug your code by yourself at first."

Sean de Wolski
Answer by uncung fgv on 1 May 2012

this tutorial make me afraid asking question here. you people cruel.

3 Comments

Oleg Komarov on 1 May 2012

It's all about the mismatch in expectations and the delivery of the problem/solution.

This tutorial tries to establish some guidelines to get rid of these two problems and help the poster to get an accurate and fast answer.

Mismatch in expectations:
- posters form specific expectations on how contributors perceive their question;
- contributors have very different backgrounds.

Delivery of the question/answer:
- posters are exposed to the risk of forming a very narrow perception of the problem (the more you look at it the less you notice alternative solutions), and they may have conveyed the problem unclearly.
- contributors may propose a technically valid solution which however doesn't match the background of the poster in the result that disagreement bears the same meaning (but the solution is discarded by the poster).

One point that should actually be crystal clear to the poster: ignoring the suggestions of this tutorial will NOT add additional penalty to your question, i.e. unclear questions would get the same reaction even if this tutorial did not exist. The only way to improve is to build some awareness and minimal standards, and this is what I was trying to do.

This tutorial tries to eliminate the mismatch between uncorrect or biased expectations of the poster and the actual reaction of the contributors.

Walter Roberson on 1 May 2012

Suggestions for rephrasing are welcome.

There have been over 37000 Questions posted here in 16 months, an average of more than 75 Questions per day. A lot of what is written above is based upon experiences of what works efficiently and what does not.

Jan Simon on 1 May 2012

I do not feel cruel. I've written "Please format the code as explained at the 'Markup help' link" more than 100 times. I do this, because a (more) readable question increases the chance to get a helpful answer. It would be more useful if all newcomers in this forum read the instructions at first, but to face the fact: they don't.

uncung fgv
Answer by Thomas on 1 May 2012

Maybe this post should be a 'sticky' post at the top of the answers forum..

1 Comment

Oleg Komarov on 1 May 2012

This point has been debated many times. Look also at the last link in the main post ( http://www.mathworks.com/matlabcentral/answers/994-wish-list-for-matlab-answer-sections#answer_8607 ).

Thomas

Contact us