| Date | File | Comment by | Comment | Rating |
|---|---|---|---|---|
| 18 Aug 2009 | play_sound play_sound loads and plays the specified sound file. | Tim | Missing function substr |
|
| 16 Aug 2009 | save_to_base.m copies variables from the workspace of the calling function to the base workspace | Donald | I found trouble when I had a stray "ans" variable floating around. I got this message: ??? The variable "ans" is undefined. To avoid trying to copy "ans", I modified save_to_base.m so that the for loop now reads: for i= 1 : length(variables)
Very nice little function. |
|
| 03 Aug 2009 | Figure Slideshow Generator The function showfigs() generates a slideshow of all open figures. | Paul | I've been looking for something like this for a while! thanks!!! |
|
| 10 Jul 2009 | meow.m For cat lovers everywhere. | Komarov, Oleg | I hid my lap behind a wall and put on at max volume this code:
after a while some people started to gather, guessing what was going on...somebody almost called firemen!
|
|
| 10 Jul 2009 | meow.m For cat lovers everywhere. | Raghavan, Manu | Meows quite adequately. |
|
| 07 Jul 2009 | meow.m For cat lovers everywhere. | Hull, Doug | LOL Does indeed meow as documented. |
|
| 18 Jun 2009 | Figure Slideshow Generator The function showfigs() generates a slideshow of all open figures. | Ryan | Awesome. Quite awesome. I often have a lot of figures open for comparison and it's great to cycle through them easily. Thank you for a great submission. |
|
| 18 Jun 2009 | Figure Slideshow Generator The function showfigs() generates a slideshow of all open figures. | cagatay | very helpful. thank you. one suggestion: right now when you press right arrow for example, it says "don't know how to handle" and terminates the slide show. It would be great if the function just ignores unassigned keys and terminates the slide show only for Escape or q. |
|
| 20 May 2009 | choose.m compute number of ways of choosing m objects from n distinct objects | Jos (10584) | If it is all about speed, remove the error checks! For larger numbers the following formula is more appropriate:
|
|
| 19 May 2009 | choose.m compute number of ways of choosing m objects from n distinct objects | Feldman, Phillip M. | Darren and John- Most of what I do with Matlab is simulation. From the standpoint of a simulationist, nchoosek is probably more suitable in the development/debugging stage of a simulation, but once the development and debugging has been done, one wants the code to run as fast as possible. Below are the results of a simple timing comparison of nchoosek and choose: >> mytime(0); for i=1:1e6; nchoosek(52,13); end; mytime;
>> mytime(0); for i=1:1e6; choose(52,13); end; mytime;
Note that my function runs over four times as fast as Matlab's builtin function. For the user who invokes nchoosek small numbers of times from the command line, the difference in speed is unimportant. But, when nchoosek or choose is being called millions or tens of milions of times from within a program, the difference becomes important. Please let me know if further explanation is required. |
|
| 18 May 2009 | choose.m compute number of ways of choosing m objects from n distinct objects | D'Errico, John | Why submit functions that do the same thing that existing utilities in MATLB do better? nchoosek does the same computation, but does it better, since nchoosek offers more functionality, and already exists in every copy of matlab for as far back as I can recall. This has little in the way of error checking. No H1 line. Admittedly, if you are trying to compute large binomial coefficients, you will be far better off using a variety of other tools. But this one fails when it needs not do so. >> nchoosek(1000,800)
>> choose(1000,800)
|
|
| 18 May 2009 | cell2num.m convert a cell array to a double precision array | us | why do you submit another author's (unaltered?) code - just
http://www.mathworks.com/matlabcentral/fileexchange/24109 it would be more prudent to ask the author to submit it him/herself and then add it to the above... us |
|
| 18 May 2009 | cell2num.m convert a cell array to a double precision array | Jos (10584) | See CELL2FLOAT
for a more flexible implementation. And who is the author of this submission? Vasi or Feldman? |
|
| 17 May 2009 | choose.m compute number of ways of choosing m objects from n distinct objects | Rowland, Darren | This is a poor submission to the FEX. It provides nothing that nchoosek does not, and computes the result in a way which is more susceptible to roundoff error. The input checks are inadequate and no warnings are given for large output values. Here is the file contents function k= choose(n, m)
% Check input arguments: if (nargin ~= 2)
if (m < 0 | m > n)
% The simplest definition of choose(n,m) is n! / (m! * (n-m)!), but the
if (m >= n-m)
else
|
|
| 17 May 2009 | show_colors.m generates a labeled plot showing all colors recognized by RGB.m | D'Errico, John | Perhaps fig may be available on the internet, but where? Give a link. Is it really that difficult to be friendly to those who might try to download your work? Is it really necessary for others to be forced to do these searches to find out how to use your code? IF your code uses something that will not be available in MATLAB proper, then tell people about it. If it uses a toolbox function, then show that toolbox as a dependency. If it uses another FEX submission, then tell people about it. Put a link in your code that shows where to find it. Do NOT post code that has dependencies without that information, as this then is non-working code. Non-working code is by definition poor. |
|
| 17 May 2009 | Figure Slideshow Generator The function showfigs() generates a slideshow of all open figures. | Nisky, Ilana | helpful |
|
| 17 May 2009 | show_colors.m generates a labeled plot showing all colors recognized by RGB.m | Nisky, Ilana | After writing the comment I browesed the file exchange for a while and I ran into the fig function... Liked the fig function as well :) Any way, I find the colors.m helpful - it is always annoying to choose the colors by guessing... |
|
| 17 May 2009 | show_colors.m generates a labeled plot showing all colors recognized by RGB.m | Feldman, Phillip M. | Actually, fig is available (separate download). cell2num was missing, but I've submitted it now. |
|
| 16 May 2009 | show_colors.m generates a labeled plot showing all colors recognized by RGB.m | Nisky, Ilana | Cute idea.
|
|
| 14 May 2009 | hostname.m Report the name of computer on which Matlab is currently running. | us | use of java system calls is (likely) a more os independent way to retrieve such information, eg, http://www.mathworks.com/matlabcentral/fileexchange/20321 us |
|
| 14 May 2009 | show_colors.m generates a labeled plot showing all colors recognized by RGB.m | us | unfortunately, this script does not run due to missing functions - cell2num
us |
|
| 14 May 2009 | hostname.m Report the name of computer on which Matlab is currently running. | D'Errico, John | Macs will return either of MACI or MAC, depending upon whether the system is an older or new inter Mac system. The help for computer.m states this fact. So hostname still fails to work on older MAC systems, although it will probably now run on intel based macs. Also, this submission too has the flaw that it has a blank comment line BEFORE what serves as an H1 line. Since that disables lookfor, it is a flaw, and a silly one. I'm not at all sure why the author insists on doing this. It is unfriendly to disable a very useful feature of MATLAB for absolutely no good reason. |
|
| 14 May 2009 | logarithmic rounding does logarithmic rounding using any of 7 modes | D'Errico, John | I see that the code has been updated to provide vectorized operation. As always, I should consider raising my rating. First, I looked for an H1 line. No. Still a blank line as the very first line of the help. This is utterly silly, since the second line of the help is a perfectly serviceable H1 line. This disables lookfor. Interestingly, the help facility that automatically builds a contents file for directories using the first lines of the help blocks finds roundl. But lookfor is itself disabled here. So this problem has not been repaired. How bout the vectorized question? x = rand(1,5)*100
roundl(x)
By default, roundl uses a rounding strategy, i.e., a rounding mode of 'n'. But it can round up or down, more like a ceiling or floor operation then. All of these operations work nicely, and a default appears to be supplied for the rounding mode if necessary. Or is it? roundl(x,'n')
roundl(x,'u')
roundl(x,'d')
Now try the code by adding the third argument. The third argument to roundl allows you to control the levels rounded to. roundl(x,'n',7)
No problem so far. But what happens if you don't wish to change the default for the rounding mode, only the default for n? The paradigm in MATLAB when you have variables that will take on a default is if the variable is left empty ([]), then use the default. Does this work? No. This fails. I tried these things: roundl(x,[],7)
roundl(x,'',7)
I even tried this: roundl(x,7)
As I said, this fails to follow the standard MATLAB paradigm for default arguments, which makes the code not very friendly. If you wish to change the rounding level, you must also provide a default for the other parameter. It is a truly silly flaw, because is it really that difficult to write your code as: if (nargin < 2) || isempty(n), mode= 'n'; end versus the line as it was written? if nargin < 2, mode= 'n'; end Sorry, but it is easy to write friendly code, and it is easy to make the code compatible with lookfor. Given this newly found problem, a 3 rating still applies here. |
|
| 14 May 2009 | hostname.m Report the name of computer on which Matlab is currently running. | Dalon, Thierry | (For windows only?)
See example:
status = 0 name = RBGD0SGC >> length(name) ans = 9 That is to my opinion the only benefit for such an easy wrapper function else. |
|
| 13 May 2009 | hostname.m Report the name of computer on which Matlab is currently running. | D'Errico, John | Despite the claim, this fails to run on all operating systems. Try it on a PPC Mac. No go. unix('hostname') works fairly well if you are on a PPC mac. I've not verified it is correct for an intel mac. |
|
| 13 May 2009 | find_cross.m, version 2.1 Find and/or estimate level crossings using a combination of search and interpolation. | CanĂ³s, Antoni J. | Phillip, please have a look at findX.m (File ID: #23860).
It is based on find_cross.m but with an optimized code, completely vectorized, without the restriction of column vectors and with some new features. |
|
| 08 May 2009 | logarithmic rounding does logarithmic rounding using any of 7 modes | D'Errico, John | I quite liked the basic idea when I saw it. However, there are a couple of flaws I found. The first was a surprise to me. It is not vectorized? roundl(rand(20,1)*100)
Error in ==> roundl at 91
So this takes only scalar input? You are kidding me, right? A silly thing, IMHO. Since this is absolutely trivial to vectorize, why not do so? The help was quite reasonable in general. It was missing an H1 line. Well, actually, it HAS an H1 line, but in the wrong place. There is a blank comment line as the very first line of the help. This causes problems for the lookfor function, since it looks at the very first comment line in the help block. Why do you want lookfor to work? Lookfor is the tool that your user will use next month or next year when they forget the name of your function. But by leaving that first line blank, you just disabled lookfor. I did find error checks that seemed reasonable. Mlint points out a couple of minor items, like the use of | instead of || in conditionals. Read the help for relop to learn the difference. |
|
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.
Contact us at files@mathworks.com