Date  File  Comment by  Comment  Rating 

05 Nov 2013  COMBINATOR combinations AND permutations Returns 1 of 4 different samplings on the set 1:N, taken K at a time.  Matt Fig  Alesya, That is a memory limitation on your computer. You are asking MATLAB to build a matrix that is (5^13)by13. This is a matrix with nearly 16 billion entries. In double precision this would require over 100 GB of RAM! You probably need to do something different for your particular application. 

05 Feb 2013  gaussleg Calculates the integral of function f from a to b using ngp Gauss points.  Matt Fig  Giuseppe, what are you talking about?? >> f=inline('sin(x)/x');
ans = 1.8922 >> f=@(x) sin(x)./x;
ans = 1.8922 >> version ans = 7.14.0.739 (R2012a) 

15 Jan 2012  MATLABTETRIS Another MATLAB version of the classic game, Tetris.  Matt Fig  Thanks for your comment Mingjing! I am surprised that the game is sluggish on your laptop, as I tested it on 3 laptops out of concern over its graphicsintensive nature. I guess my sample was too small! One of the goals in making the game was to be able to have everything in one file, which is why I didn't use an image (or any of the other approaches I could have). Now I wonder if I could created the image from repmatting a hardcoded matrix inside the file? I will look into this in the coming weeks when I get time, and see if it speeds things up at all. Thanks for the idea! 

13 Jan 2012  Band matrix generation Generates a band matrix  Matt Fig  Caitlin, why did you submit two identical files? Did you do this by mistake, perhaps? Also, you really should at least familiarize yourself with the ONES function in MATLAB, it would be most useful in your function... 

01 Jul 2011  Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector  Matt Fig  Jan, you are absolutely correct. I made a mistake in understanding what this was supposed to do. Thanks for the catch. Good thing I didn't provide a rating! 

30 Jun 2011  Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector  Matt Fig  Why not use the simpler: out = ini + ceil((finini)*rand(1,num)); 

30 Jun 2011  sahil_tar sahil_tar  Matt Fig  Please delete this and ask your question on MATLAB Answers. The FEX is not a place to ask questions like this... 

21 Jun 2011  How fast is your graphics card? Creates a challenging 3d benchmark for graphics processing speed measurement.  Matt Fig  That should say: i72920xm processor I don't know where I got that other number? 

21 Jun 2011  How fast is your graphics card? Creates a challenging 3d benchmark for graphics processing speed measurement.  Matt Fig  7.14 RPM
Blow my old Dell (see above) away! 

16 May 2011  showcontextmenu Simple way to show contextmenu on left click in a nice dropdown way.  Matt Fig  This function will error on versions of MATLAB which do not have ASSERT. For example 2006a.


13 May 2011  axescenter Puts axes in the center of a plot. Zooming, panning and some command line manipulations allowed.  Matt Fig  Hello Robert, There is no guarantee the axes go through the origin with any plot. This will depend on the data. But if the data is so centered, axescenter will go through the origin. Also, I cannot reproduce your claim about the xlabel. For example: subplot(1,2,1)
Please email me if with some code to reproduce what you are seeing... 

13 Apr 2011  LINECMENU Utility for creating a standard uicontextmenu for line objects.  Matt Fig  Great idea Oleg, thanks! I have submitted an update. 

24 Mar 2011  BPSK BER simulation correlative detector for BPSK signal  Matt Fig  There is no mention that the communications toolbox is required. The files will not run asis, for MATLAB doesn't recognize filenames which begin with a number. Rename the files! Also, why use scripts? Finally, please preallocate your variables instead of growing them in a FOR loop. This makes your code unbearably slow. 

01 Mar 2011  41 Complete GUI Examples 41 working GUIs to read and learn.  Matt Fig  To fremond, What do you mean, "open" the file? For editing? Just type: >> edit GUI_1 If you have other problems, please email me instead of using the ratings area. 

03 Jan 2011  ChooseK All pairs intersecting on k1 tuples from all possible ktuples of n objects  Matt Fig  There is no mention of the need for MERGESA other than the error message I see when trying to run the file. Other than that, this is a nice recursive solution to the combinations without replacement problem. 

04 Dec 2010  TRIGDEMO Allows user to see how parameters affect plots of trigonometric functions.  Matt Fig  Good idea Oleg. I seem to remember thinking I should do this when I wrote it, but rejecting the idea for some reason. I will think about it some more and update the file if I can't remember my initial reason for rejecting this idea. 

28 Sep 2010  Golden Ratio Computes the golden ratio.  Matt Fig  While I see and acknowledge Mark's point, I do think this could be useful. For example, one could also use 2*asin(1) for pi and yet it is still useful to have a PI function. One may forget the formula, for instance, and looking it up is slower than just using the function.
>> tic,for ii = 1:5000,T = GoldenRatio;end,toc % original


09 Sep 2010  rotation rotation of two dimensional shapes  Matt Fig  Did you know about the MATLAB function ROTATE? 

10 Aug 2010  COMBINATOR combinations AND permutations Returns 1 of 4 different samplings on the set 1:N, taken K at a time.  Matt Fig  Oops, that was an error of omission on my part. I will post an update. Thanks Jan. 

16 Jun 2010  cell2char Function to convert a cell array of strings into a character array.  Matt Fig  I see, your code handles cells like this: C = {'poss';'pess';'asdf';NaN;44;pi;'cookie'} So it is the description you give that needs fixing. It does more than convert the contents of a cell array of strings. It converts the contents of a cell array of strings and/or numbers. However, couldn't your entire algorithm be replaced with this? S = char(cellfun(@(x) num2str(x),C,'Un',0)) 

16 Jun 2010  cell2char Function to convert a cell array of strings into a character array.  Matt Fig  Maybe I missed it, but what does CELL2CHAR(C) do that CHAR(C) does not do? And CHAR is a builtin! 

10 Jun 2010  CHECKVARS Checks for function masking by variables in an MFile.  Matt Fig  It was brought to my attention that there are a few shortcomings in the file. The file will be updated shortly. 

21 May 2010  Antidiagonal matrix traversal This function allows you to traverse a square matrix along the antidiagonal.  Matt Fig  As it is, you have some deficiencies. There is no H1 line. The help is nonstandard in its location. There is no input checking: if the function is for square matrices then you should check to see if the input is square. Your algorithm works well, except you cripple the speed by not preallocating your return arrays before the loops. Look at the difference: >> M = round(rand(400)*300);
You should preallocate the return arrays! 

19 May 2010  A more short code forgenerating a random matrix A of (1,1); A more short code for generating a random matrix A of (1,1),no loop  Matt Fig  A general, ND version could look like: function A = randmatrix(varargin)
The 2D limitation, in addition to the need for usable help, a more descriptive name (something like RANDSIGNONES at least describes more closely what the code produces), and an H1 line prevent the file from being that useful as it now stands. 

12 Apr 2010  Sort Matrix Elements with Positions A function to sort values of the matrix elements, providing their positions in original matrix.  Matt Fig  There is no help, and no real H1 line in this file. Why not use the faster engine: [As,Y] = sort(A(:));


29 Mar 2010  NFACTORK Find all factorings of N which have K elements.  Matt Fig  Thanks for the ideas, I will submit an update on the bug. 

29 Mar 2010  NFACTORK Find all factorings of N which have K elements.  Matt Fig  John,


04 Mar 2010  41 Complete GUI Examples 41 working GUIs to read and learn.  Matt Fig  Lorenzo and Jie,


09 Feb 2010  Password GUI It is a gui, with a dialogbox to input a password  Matt Fig  The GUI errors if the incorrect password is entered. Is this the expected behavior? 

26 Jan 2010  Kronecker Delta Given 2 subscripts, j & k, KronD will return 1 if j == k and 0 if j != k.  Matt Fig  eq(j,k) does the same thing. If you are looking for a function which takes arguments, as opposed to an operator (i==j), why not use the builtin? 

08 Jan 2010  COMBINATOR combinations AND permutations Returns 1 of 4 different samplings on the set 1:N, taken K at a time.  Matt Fig  Thanks, Jan. I will look into your suggestions and, if my findings match yours, will offer an update. I appreciate the speedup! 

17 Dec 2009  N_PERMUTE_K All possible permutations of the elements of set N, taken K at a time, with repetition.  Matt Fig  Jan,


23 Nov 2009  Unique Rows for a cell array Find unique rows of a cell array containing columns with strings or scalars, or ND matrices  Matt Fig  This is much faster, and has no requirement as to types or ordering: ii = 1;
For example, try it with:


31 Oct 2009  COMBINATOR combinations AND permutations Returns 1 of 4 different samplings on the set 1:N, taken K at a time.  Matt Fig  Michele,


07 Sep 2009  41 Complete GUI Examples 41 working GUIs to read and learn.  Matt Fig  Cyberfrog,


06 Sep 2009  41 Complete GUI Examples 41 working GUIs to read and learn.  Matt Fig  Hello CyberFrog,
No *.fig file is generated because these are Mfile GUIs. GUIDE works by generating two files, an MFile which has the code, and a figure file which has the graphics. These are simply two different ways of doing GUIs in MATLAB. I much prefer to write my GUIs without GUIDE for many reasons, only one of which is that I need to keep track of only one file! This collection, as is stated in the description, is meant to help people write GUIs without using GUIDE. 

04 Sep 2009  ATAN2_SAFE To perform the same function as Matlab builtin function atan2 but safely guarded against erroneous  Matt Fig  Actually atan2 is fine. The source of the error in your example is this line: [x2 y2 z2] = sph2cart(t2, p2, r2); % step 5b The value of y2 should equal zero but there are roundoff errors occurring. If you simply assign y2 = 0 after this line in your example, you will see that t1 is back at zero as expected. This has nothing to do with atan2. 

04 Sep 2009  NUMUNIQUE Returns unique elements in an array and all the indices for the repetitious values.  Matt Fig  Well done. About the only thing I would change would be to replace these lines: n = 1:N;
with n = find(diff([nan; x])); On my machines this can make a significant difference in speed. Other than that, great code! 

13 Aug 2009  41 Complete GUI Examples 41 working GUIs to read and learn.  Matt Fig  Tanguy,


09 Aug 2009  ds group contribution  Matt Fig  A script. Not one single comment, let alone explanation. 

09 Aug 2009  AutoWarnDlg Selfterminating modal warning dialog with flashing icon  Matt Fig  Works well. One thing I would like to see added is an optional second output which stores whether the dialog terminated due to timeout or user acknowledgment. That way if this was called from a code which was running automatically, the user could be notified that a warning was thrown earlier. This could be useful for debugging. 

01 Aug 2009  Fractions Toolbox create and manipulate fractions (K+N/D) using exact arithmetic  Matt Fig  Great work! 

28 Jul 2009  41 Complete GUI Examples 41 working GUIs to read and learn.  Matt Fig  Thanks someone,


28 Jul 2009  41 Complete GUI Examples 41 working GUIs to read and learn.  Matt Fig  I like the contents.m idea, and I might as well since a typo has already been found. In the pdf I refer to a comment in GUI_30. I should have put GUI_32. File will be updated. 

13 Jul 2009  N_PERMUTE_K All possible permutations of the elements of set N, taken K at a time, with repetition.  Matt Fig  Juliette, You cannot index the output of npermutek(1:5,5) into an array (nuc) of length 4! The index exceeds dimensions because the output of the above call to NPERMUTEK will have many '5's in it. You will get the same error by doing this: nuc = 'ABCD'
This is not an NPERMUTEK problem, it a user misunderstanding the output problem. 

07 Jul 2009  reshape2cube Reshape a vector into a cubic array  Matt Fig  I am with Darren. Maybe a generalization would be more useful: A = 1:5^2;


29 Jun 2009  Longest Common Subsequence Gives the longest common substring between two stings.  Matt Fig  Something is still wrong. [D,G,S] = LCS('fbce','abcde');S


25 Jun 2009  kronecker Kronecker tensor product  Matt Fig  Fast, slick, well done.


24 Jun 2009  EXPAND Replicate and tile each element of an array.  Matt Fig  Another reason I bypassed kron is illustrated here: http://i217.photobucket.com/albums/cc229/spamanon/tester_output2.png Urs, I think you are correct about mentioning kron in the see also. 

24 Jun 2009  kronecker Kronecker tensor product  Matt Fig  My only question is why the function errors out for non 2D inputs? The stock MATLAB function does not error, and if I take the offending lines of code out of kronecker, the results match. 
