What would you add to my Matlab cheatsheet ?

조회 수: 6 (최근 30일)
Thor
Thor 2013년 8월 15일
I am always adding and removing stuff for my Matlab cheatsheet and would like everyones opinion on what they would add/remove.
I like to have even the very basic stuff there so i can share it with others.
Cheers ps. would love to hear what you are using Matlab for when you suggest changes

채택된 답변

Jan
Jan 2013년 8월 25일
편집: Jan 2013년 8월 25일
  • The page numbers 91 and 92 seems to imply, that there are some more hints.
  • I would omit "median(x) median" and "mean(x) mean".
  • cd is mire direct than pwd to get the current directory.
  • "sprintf(x) formated data to a string" does not mention the more interesting format specifiers.
  • fprintf is important also, while "disp(x) Displays the string x" leaves out the real power of disp to display all Matlab arrays.
  • The leaner a cheat sheet, the better. So "It is easy to create functions:" does not help.
  • "bsxfun(fun,A,B) fun is elementwise applied" does not hit the point of the auto-expanding of singleton dimensions.
  • "int16(x)=y" is no valid Matlab syntax.
  • Matlab does not have a "sqr" function.
  • "find(A>5) nds element nr. >5": No, FIND does not determine the number, but the indices.
  • "B=repmat(A,m,n) Makes B from A" does not hit the point of the replication.
  • kron() is missing, but it solves many problems.
  • zeros, ones, NaN, Inf could be summarized in a single line.
  • "figure(j) graphics object j, j is an integer": The handle of figures can be an integer for backward compatibility. Non-integer handles are safer.
  • "get(j) returns information on figure j": get operates on all HG-objects and a lot of other objects also, see help get.
  • "subplot(a,b,c) Creates plot aXb matrix and puts figure into position c" is not clear. subplot does not create a figure, but an axes object.
  • In "print(figure(CurrentFigure),'-depsc2','path\image.eps')" the figure command is useless. Better: "print(FigureHandle,'-depsc2','path\image.eps')".
  • "isnummeric(x)" has one "m"
  • The difference between "&&" and "&" is important.
  • Duplicates can be omitted: ver, [A;B] and x=[1; 2; 3], diff,
  • The most important detail of inv(A) is, that it is usually not required and \ is more efficient.
  • "size(x) rows and cols" matters matrices only, but size has more features.
This means, that I'd apply fixes at first, omit redundant and rarely needed information, before adding further commands. And finally I'm not sure for which kind of user this sheet might be useful for. You personally have learned enough Matlab during creating the sheet, that you do not need it anymore. And for a Matlab beginner would be confused by the omitted or inaccurate details.
  댓글 수: 1
Thor
Thor 2013년 8월 26일
Thanks :) I used most of your suggestions!

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Jan
Jan 2013년 8월 18일
  • j:i:k does not create j, j+i, ..., k, see: 1:2:4
  • "while switch" might mean "switch case"
  댓글 수: 2
Thor
Thor 2013년 8월 18일
Thanks
You are right that j:i:k does not exactly do that, but it is mostly right. Ofcourse like you point out if we do 1:2:4 we get 1 3. And yup the while switch was meant as switch case :) thank you
No functions you would add :) ?
Richard Brown
Richard Brown 2013년 8월 18일
While we're at it, transpose is .'

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2013년 8월 19일
When you're adding x and y you don't need the dot, you can just do x+y. You might run it through a spellchecker to correct numerous spelling errors. You might add intmax and realmax to the list of useful built in functions.

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by