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

1.430 Ansichten (letzte 30 Tage)
Oleg Komarov
Oleg Komarov am 25 Apr. 2011
Kommentiert: Rik am 23 Apr. 2022
[ Section 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). Translating it into English will get you more responses, though is not necessary. You don't have to use the Google Translate capability, though it can't hurt, it can only help by letting a broader audience understand your post.
3) Show what you have attempted so far and if you have got:
  • an error then post the whole error message. We need ALL the red text, not just a small part snipped out of it. This means line numbers, actual lines of code that generated the error, traceback to prior functions, etc. - everything that is in red color.
  • unwanted results, then post a brief example of your inputs and the desired output.
4) If it's a homework problem or class assignment that you will be graded on, assign a tag of "homework" and read this.
5) Provide standalone code that is properly indented and properly formatted AS code: how to format your question with markup. Use the paperclip icon to attach all m-files, fig files, data files (.mat, .txt, .csv, etc.) necessary for people to run your code. In MATLAB, BEFORE you paste into Answers, highlight your code, then type control-a (to select all text) then control-i (to properly indent your text). Then paste it into the Answers edit text box. Then highlight your code and click the Code icon on the Answers toolbar to properly format it. A common cause for delays in getting an acceptable solution is posting code that doesn't run because it was snipped out of the middle of a program and required variables were assigned in code above that was not included with the Answers post.
6) Before you click on the submit button, review your question for misspelling.
7) Use the Products section to list the toolboxes that are relevant to your question. You don't need to list MATLAB - it's assumed that if MATLAB is not listed that you are using MATLAB.
8) Say what version you are using . Sometimes functions come into existence at a particular version and if you have a really old version you may not be able to use the solution and you would need alternate solution that will work for your old version.
9) Use relevant tags. Tags such as MATLAB, MATLAB Code, help me, error, etc. are not helpful because they add no additional useful information that someone could use to decide if they have expertise about your problem or not.
10) If you're dealing with an image, plot, graph, etc. use the insert picture icon on the Answers tool ribbon to attach a screenshot of it.
11) if you see that your question has one answer, make sure you scroll down to the bottom of the page so that you see the official Answers section. Sometimes people will post a comment up top, immediately under the question in the comments section, and then the questionner thinks that is the answer and doesn't realize that there is an actual answer further down the page.
How to thank people who helped you:
1) If (and only if) one of the answers is the solution for your problem, click Accept this answer, and say thank you in a comment. Volunteers prefer a actual Thank You comment rather than a "thanks in advance" in your original question, and then never hear from you ever again (so they don't know whether their answer was even read by you).
2) Vote for good answers. Voting and Accepting give the person "reputation points" which can earn them privileges in the forum. You can vote for more than one Answer and you can even Vote for the one you Accepted to give that author double reputation points.
3) Do not accept your own answer unless it is the best complete/detailed solution and you formulated it independently without using any of the information provided by the others who offered answers.
--------------------------------------------------------------------------------------------------------------------------------------
[ Section II ] EXAMPLES OF GOOD QUESTIONS:
Example 1: How can I speed up this loop?
A = [];
for k = 1 : 10
A = [A, k];
end
Example 2: I get an error. What caused it and how do I fix it?
>> 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)
--------------------------------------------------------------------------------------------------------------------------------------
[ Section III ] DON'Ts:
All of the following points are addressed in section [I] or by common sense.
  • Don't use demanding or commanding tone
  • Don't use textspeak such as plz, u, r, ur, kewl, abt, thx, b/c, etc. Some English speakers don't even know what those are, and it's even more difficult for non-native English speakers.
  • Don't ask for turn-key, ready to use code
  • Don't ask to solve your homework. Certainly don't just copy and paste your homework with not additional information about what you tried or what you are having trouble with. Read this homework tutorial.
  • Don't use URGENT in any part of your post and why your post is NOT urgent.
  • Don't assign useless tags that don't convey additional information, such as matlab, matlab code, matlab function, matrix, array, help, please, urgent, error, etc. Don't assign a tag of matlab coder unless you're actually using the MATLAB Coder product, and if then, list it in the product section.
  • Don't use HEEELP, MATLAB, PLEASE in your title. Use a meaningful title.
  • Don't post your code in the comments. Edit your original question adding formatted code.
  • Don't put the whole question into the subject line or the tag. Keep those short.
  • Don't post duplicate questions.
  • Don't post multiple answers on the same thread (don't rely on chronological order of answers then). Use comments.
  • If you want to answer a question, don't answer it in the comments section at the top. Go down a little and answer it in the Answers section.
-------------------------------------------------------------------------------
[ Section 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 may apply to your post.
  • You have been asked to post more details (so it was confusing or ambiguous, or you left out code or data needed to run the code.
  • You didn't format your code properly, so people cannot read it.
  • 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 got no Answers and no Comments at all.
  • Your question may be so esoteric, so specific, that there are very few people who know how to answer your question, and perhaps the only one who can answer it just has not seen it yet.
------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------
[Section V: ACKNOWLEDGMENTS]
In alphabetical order by nickname, thanks for their suggestions to:
Andrew Newell, Andy, Image Analyst, 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.
Edit: Removed line about not being able to unaccept answers as no longer being true (Adam)
  16 Kommentare
Abdulalim Alnajjar
Abdulalim Alnajjar am 23 Apr. 2022
Bearbeitet: Rik am 23 Apr. 2022
https://www.mathworks.com/matlabcentral/answers/uploaded_files/975330/Screenshot_20220423-154028_Write%20on%20PDF.jpg Could someone please help me with this formula, I want to type it in matlab, but mine wilas wrong, can you show me please how to insert it Thanks a lot
Rik
Rik am 23 Apr. 2022
@Abdulalim Alnajjar did you really ignore all the advice on this page to post your question here?

Melden Sie sich an, um zu kommentieren.

Antworten (14)

Rick Rosson
Rick Rosson am 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.

Andy
Andy am 16 Mai 2011
Bearbeitet: Image Analyst am 29 Dez. 2021
Do:
Don't:
  • Ask questions about the original question, OR any existing Answer, by adding another new Answer. (Use the "comment" feature. That's what it's there for. Answers will change order over time. Comments will not. The original question has a "Comment on this question..." link below it, and Answers have a "Comment on this answer..." link below them.)
  2 Kommentare
Jan
Jan am 16 Mai 2011
Check the FAQ. Check the FAQ. Check the FAQ.
Read DOC. Read DOC. Read DOC.
Andrew Newell
Andrew Newell am 20 Mai 2011
Bearbeitet: Image Analyst am 30 Aug. 2019
It never ceases to amaze me how many people ask questions that can be answered by a quick web search. How did they manage to find MATLAB Answers?
Occasionally I suggest a search string for Google - as a comment, since it's not really worth submitting as an answer.

Melden Sie sich an, um zu kommentieren.


Sean de Wolski
Sean de Wolski am 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!"

Paulo Silva
Paulo Silva am 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

Matt Tearle
Matt Tearle am 5 Mai 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 Kommentar
Image Analyst
Image Analyst am 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!

Melden Sie sich an, um zu kommentieren.


Andrew Newell
Andrew Newell am 15 Mai 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.

Walter Roberson
Walter Roberson am 11 Aug. 2011
Bearbeitet: Image Analyst am 29 Dez. 2021
Do: post the relevant parts of your actual code, or a simplified 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. However it's best to have code to create all needed variables or else include your variables in a .mat file that you attach with the paperclip icon. Do not post images of your code. We can't run images. We need actual text that we can copy and paste into our own MATLAB.
Do not: type in an untested approximation of your code. You will probably make mistakes in variable names or in call syntax, or miss some details, and then people will end up debugging your typing mistakes instead of debugging your real difficulty.

Walter Roberson
Walter Roberson am 1 Dez. 2011
Bearbeitet: Image Analyst am 29 Dez. 2021
DO:
Phrase your post as a question.
The question, especially the subject line, 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 a 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. Moreover if you post your homework problem, and someone solves it for you, then you should not turn in their code as your own because you could get into trouble with your school for cheating.

Chad Greene
Chad Greene am 23 Jun. 2016
Bearbeitet: Chad Greene am 23 Jun. 2016
Phrases like "doesn't work" and "didn't work" do not sufficiently describe a problem.

uncung fgv
uncung fgv am 1 Mai 2012
this tutorial make me afraid asking question here. you people cruel.
  6 Kommentare
Walter Roberson
Walter Roberson am 24 Okt. 2020
(At the moment, we are averaging just under 200 new questions per day, and this is not the busiest time of year.)
Mario Malic
Mario Malic am 24 Okt. 2020
Well, I hope the trend continues :-)
It would be cool to have displayed statistics on answers somewhere on the MATLAB Central.

Melden Sie sich an, um zu kommentieren.


Walter Roberson
Walter Roberson am 8 Feb. 2021
If asking how to convert code from a different programming language into MATLAB,
DO:
  • ensure that the code compiles in that other programming language.
  • debug it in the other programming language.
  • Use comments and documentation in the other programming language
DO NOT:
  • expect the volunteers to know the other language well enough to be able to debug programs in the other language by sight and then translate the debugged program into MATLAB.

Sean de Wolski
Sean de Wolski am 8 Mär. 2012
If you are getting a: Crash/SegV or Java Exception, contact technical support:
  1 Kommentar
Jan
Jan am 8 Mär. 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."

Melden Sie sich an, um zu kommentieren.


Thomas
Thomas am 1 Mai 2012
Maybe this post should be a 'sticky' post at the top of the answers forum..

Melissa Williams
Melissa Williams am 12 Dez. 2018
The new MATLAB Answers Rich Text editor allows you to
  • simply format your code and text without the need for markup
  • insert images and equations to help explain
  • use bulleted and numbered lists
In short, help you ask clearer questions and get and give clearer answers.
(I personally am a fan of bulleted or numbered lists to help convey steps or things you've tried)

Kategorien

Mehr zu Historical Contests finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by