In a recent post, I showed how Roger did a mash-up of two prior Picks. In the video, I actually made a request that someone make some further modifications to the code. This concept of asking other people to do software development tasks for you is often called “LazyWeb”.
We think it would be fun to have a page where people describe functions that they wish existed on the File Exchange. In other words, ask everybody on the web to make you something, and somebody might just do it. The key is to make a very clear and reasonable request. Leave a comment on this post if you can describe functionality that you’d like someone else to write for you. I’ll put that information on my blog, and if someone actually writes the program that you describe, I’ll mention it here and send that person a MATLAB t-shirt.
I would like to have a function like this:
—–
function makeLineHighlightable(h)
MAKELINEHIGHLIGHTABLE Highlight a line when clicked on.
h can a vector of line handles, or an axes handle. MAKELINEHIGHLIGHTABLE will set a buttondownfcn callback on the line(s) (or all lines in the axes) such that when you click on it the line width will go up a couple of points so it is easier to see. Clicking on a highlighted line, will cause it to go back to normal. Clicking on a non-highlighted line will cause any other highlighted lines in the axes to go back to normal.
Thanks!
Doug
PS Get a MATLAB t-shirt and be Pick of the Week if you write this well.
I would like about twenty nice icons in a collection that would be appropriate for shortcuts in the MATLAB desktop. These icons should be useful in a variety of situations, maybe
* Generic plot
* Big red X
* Black Box
* Skull and cross bones
* Arrows
These would have a variety of colors and graphics. It would make it easier to keep all of the shortcuts straight and allow for fewer words in the shortcut description.
I would like a hand ranker for poker hands of 2-7 cards. The input format can be anything, from a binary matrix representing the cards chosen from a 52 card deck, to a list of the cards (ie. 1, 23, 52). The function would need to take either a single hand, or a set of hands and output an absolute rank of all possible hands, so a royal flush would be rank 1, and [2 3 4 5 7] of different suits would be the absolute worst hand (maybe rank 23,456,421,356). The program should be able to look at a seven card hand and find the ranks of all of the five card hands that are possible from it (same with two card hands, etc).
This should, of course, be lightning fast. If it makes it easier, the ranks do not have to be continuous (ie. There might not be a hand with rank 34 for some reason, so long as the output is easily comparable to one another. Maybe you have a vector that had five values [1 for straight flush, 2 for four of a kind, etc…, the second value would give the tie breaker within the first rank like 1 for Quad Aces, 2 for Quad kings], there would be as many tie breakers as need until each hand was unambiguously ranked).
Should be able to get a word description of the hand also, “Pair of twos with an Ace, Jack, Five kicker”
Ok Doug,
I bit. Just submitted makeLineHighlightable. Although just realized you wanted all the other lines to turn off. I resubmit with that feature.
Matt
Thank you! This file was created faster than I would have ever guessed (three hours). I have already made use of this in a project I was working on. Here is the link to the file Matt made.
I really like the paper “The End of the Rainbow? Color Schemes for Improved Data Graphics” by A. Light and P.J. Bartlein (see http://geography.uoregon.edu/datagraphics/EOS/Light&Bartlein_EOS2004.pdf). In it, the authors describe some pitfalls of colormap design, and then they provide some nice example colormaps of well-designed colormaps.
Please make me a file that creates the five colormaps shown in Figure 2. Each colormap should take an input that will let me make it arbitrarily long (just like HSV or GRAY in the MATLAB toolbox). Naming colormaps is tricky. Maybe you can give them names like DivergingRedBlue or SingleHuePurple.
Why not, Urs
I see it this way:
1) Poorly described problems are unlikely to get a response.
2) Overly complex problems are unlikely to get a response unless the issue is of great interest to someone in which case it may provide them with the motivation to write the code. Usually a well worded problem description is exactly what you need to get started.
3) It may start collaborations between individuals who did not realize they had common problems/interests.
I wrote the submission earlier because I have a lot of similar code and this particular bit of code may come in handy. I wouldn’t look at the poker hand problem because I know nothing about poker but Ned Gully’s post led to an interesting article and I might think about that at some point.
Dear Lazyweb,
What I would love is a one function that could be called in one line, which does nothing if the program is being run in MatLab, but only when it is running in deployed mode. The reason for this is I have a bunch of routines where I often want to run them multiple times, without having to launch the exe each time. So I would like the wrapper function to pop up a small dialog that asks the user: “Do you want to run the function {name of function routine was called from} or exit?” and have two buttons. If the user clicks the run button, it should be just as if the original function was run by launching the (unaltered) .exe. The dialog then goes dormant until the program is finished running, at which point it regains focus and asks: “Run again?” When the exit button is clicked, all the windows get closed, and the executable shuts down. This would be very useful to my co-workers who may have to run batches of data, that can’t be pre-determined. As a bonus, it would be very nice if this dialog has a string field and captures the output from a disp() command, instead of letting it go to the dos window.
In my own defense, I have tried to achieve this and it only works, very so-so.
OK, in response to your LazyWeb request above, I just submitted a “poker hand ranker” function to the file exchange. I’m not a big poker player, but solving games in ML is fun. I also must admit that the allure of a ML t-shirt is compelling.
I did some basic range testing on the function (rankp.m) to make sure that the worst hand of one type (e.g. full house) will not score worse than the best hand of the next lowest type (e.g. flush). Tell me if it is what you were thinking of in the request.
Nice idea. I am trying to hack suptitle for this LazyWeb request myself, but if anyone else wants to take a stab at it, here goes…
I need a function similar to suptitle, but what I really want is to add a visable header and footer to any plot that I make. It must accept multiple lines of text (a cell array) for both header and footer. It also must play well with the file exchange entry called addaxis and plots with multiple subplots.
Thanks,
Jonathan
Leave a Reply
About
Bob, Brett & Jiro share their favorite user-contributed submissions from the File Exchange.
Dear LazyWeb,
I would like to have a function like this:
—–
function makeLineHighlightable(h)
MAKELINEHIGHLIGHTABLE Highlight a line when clicked on.
h can a vector of line handles, or an axes handle. MAKELINEHIGHLIGHTABLE will set a buttondownfcn callback on the line(s) (or all lines in the axes) such that when you click on it the line width will go up a couple of points so it is easier to see. Clicking on a highlighted line, will cause it to go back to normal. Clicking on a non-highlighted line will cause any other highlighted lines in the axes to go back to normal.
Thanks!
Doug
PS Get a MATLAB t-shirt and be Pick of the Week if you write this well.
Dear LazyWeb,
I would like about twenty nice icons in a collection that would be appropriate for shortcuts in the MATLAB desktop. These icons should be useful in a variety of situations, maybe
* Generic plot
* Big red X
* Black Box
* Skull and cross bones
* Arrows
These would have a variety of colors and graphics. It would make it easier to keep all of the shortcuts straight and allow for fewer words in the shortcut description.
Thanks!
Doug
Dear LazyWeb,
I would like a hand ranker for poker hands of 2-7 cards. The input format can be anything, from a binary matrix representing the cards chosen from a 52 card deck, to a list of the cards (ie. 1, 23, 52). The function would need to take either a single hand, or a set of hands and output an absolute rank of all possible hands, so a royal flush would be rank 1, and [2 3 4 5 7] of different suits would be the absolute worst hand (maybe rank 23,456,421,356). The program should be able to look at a seven card hand and find the ranks of all of the five card hands that are possible from it (same with two card hands, etc).
This should, of course, be lightning fast. If it makes it easier, the ranks do not have to be continuous (ie. There might not be a hand with rank 34 for some reason, so long as the output is easily comparable to one another. Maybe you have a vector that had five values [1 for straight flush, 2 for four of a kind, etc…, the second value would give the tie breaker within the first rank like 1 for Quad Aces, 2 for Quad kings], there would be as many tie breakers as need until each hand was unambiguously ranked).
Should be able to get a word description of the hand also, “Pair of twos with an Ace, Jack, Five kicker”
Thanks,
Doug
Ok Doug,
I bit. Just submitted makeLineHighlightable. Although just realized you wanted all the other lines to turn off. I resubmit with that feature.
Matt
Matt,
Thank you! This file was created faster than I would have ever guessed (three hours). I have already made use of this in a project I was working on. Here is the link to the file Matt made.
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=17505&objectType=FILE
I will work up a blog post about it soon, and Helen will be in touch to get you the promised MATLAB t-shirt and other goodies!
Doug
Dear LazyWeb:
I really like the paper “The End of the Rainbow? Color Schemes for Improved Data Graphics” by A. Light and P.J. Bartlein (see http://geography.uoregon.edu/datagraphics/EOS/Light&Bartlein_EOS2004.pdf). In it, the authors describe some pitfalls of colormap design, and then they provide some nice example colormaps of well-designed colormaps.
Please make me a file that creates the five colormaps shown in Figure 2. Each colormap should take an input that will let me make it arbitrarily long (just like HSV or GRAY in the MATLAB toolbox). Naming colormaps is tricky. Maybe you can give them names like DivergingRedBlue or SingleHuePurple.
Thanks,
Ned
doug
i REALLY hope you are NOT serious about this…
urs
Urs,
Why do you hope that?
I am always looking for suggestions for more videos http://blogs.mathworks.com/pick/category/video/ to make, or code to write to help out MATLAB users. You have an impressively long list of contributions to the File Exchange http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectType=author&objectId=10786
I can only assume that some of those came about from discussions from other MATLAB users.
Doug
Why not, Urs
I see it this way:
1) Poorly described problems are unlikely to get a response.
2) Overly complex problems are unlikely to get a response unless the issue is of great interest to someone in which case it may provide them with the motivation to write the code. Usually a well worded problem description is exactly what you need to get started.
3) It may start collaborations between individuals who did not realize they had common problems/interests.
I wrote the submission earlier because I have a lot of similar code and this particular bit of code may come in handy. I wouldn’t look at the poker hand problem because I know nothing about poker but Ned Gully’s post led to an interesting article and I might think about that at some point.
More interaction is hardly ever a bad idea.
Sounds like a fabulous idea. My “Fill Page” File Exchange submission http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=16566&objectType=FILE was inspired by a blog entry I came across one day…
Sometimes people don’t realize that some code they’ve already written (or know how to easily write) can be useful in solving a more general problem.
Dear Lazyweb,
What I would love is a one function that could be called in one line, which does nothing if the program is being run in MatLab, but only when it is running in deployed mode. The reason for this is I have a bunch of routines where I often want to run them multiple times, without having to launch the exe each time. So I would like the wrapper function to pop up a small dialog that asks the user: “Do you want to run the function {name of function routine was called from} or exit?” and have two buttons. If the user clicks the run button, it should be just as if the original function was run by launching the (unaltered) .exe. The dialog then goes dormant until the program is finished running, at which point it regains focus and asks: “Run again?” When the exit button is clicked, all the windows get closed, and the executable shuts down. This would be very useful to my co-workers who may have to run batches of data, that can’t be pre-determined. As a bonus, it would be very nice if this dialog has a string field and captures the output from a disp() command, instead of letting it go to the dos window.
In my own defense, I have tried to achieve this and it only works, very so-so.
Thanks if anybody wants to take this one up.
Dan
Doug,
OK, in response to your LazyWeb request above, I just submitted a “poker hand ranker” function to the file exchange. I’m not a big poker player, but solving games in ML is fun. I also must admit that the allure of a ML t-shirt is compelling.
I did some basic range testing on the function (rankp.m) to make sure that the worst hand of one type (e.g. full house) will not score worse than the best hand of the next lowest type (e.g. flush). Tell me if it is what you were thinking of in the request.
Best,
Rob
DanK, are you still interested in a dialogue for running deployed programs in batch mode?
Doug,
Nice idea. I am trying to hack suptitle for this LazyWeb request myself, but if anyone else wants to take a stab at it, here goes…
I need a function similar to suptitle, but what I really want is to add a visable header and footer to any plot that I make. It must accept multiple lines of text (a cell array) for both header and footer. It also must play well with the file exchange entry called addaxis and plots with multiple subplots.
Thanks,
Jonathan