When called without an argument from the command line, WHATS lists the M-Files, MAT-Files and FIG-Files in the current directory as click-able links. Clicking on an M-File name opens the M-File for editing. Clicking on a MAT-File name loads the data stored in the MAT-File. Clicking on a FIG-File opens the figure. A different directory path (other than the current directory) can also be passed to WHATS as an argument, causing WHATS to list the files in that directory, and allowing the user to open or load the respective files. See the screen-shot for an example that shows the difference between WHAT and WHATS. I put this in my path so I can call it from anywhere.
Tested on 6.5, 2006a, 2007a
Please email me about bugs or other concerns. Thanks.
Matt Fig (2021). whats (https://www.mathworks.com/matlabcentral/fileexchange/20615-whats), MATLAB Central File Exchange. Retrieved .
This is probably the utility function I use the most day-to-day. Great functionality. (I've been using it for years, but forgot to rate it.)
I modified it to include the new *.mlx file type (for the MATLAB Live Editor) -- only to discover that the built-in "what" command doesn't support them yet!
Super little function.
When my command window is very narrow, I get the error
??? Attempted to access nmprln(0); index
must be a positive integer or logical.
Error in ==> whats>formatter at 87
nmprln = nmprln(end); % For BC to ver 6.5:
no 'last' arg to find func. :(
This is solved by reversing lines 87 and 88 in the code. Otherwise, it's great.
Nice utility. I like it.
I want to contact u regarding ur project "txthide" Wtas ur mail id. I couldnot find it anywhere as u hav stated...
Hey Mike, my email address should be listed at the bottom of the help for all of my files on the FEX. Thanks.
I was able to make a couple easy small modifications such that it also lists MDL files, but only if the user has Simulink installed. I was going to email the file to you to check out but with this new layout on the Matlab file exchange I can't seem to figure out how to email you.
I would propose as solution when what finds several directories not to display only the first (like in current implementation) but to display all the directories found and let the user pick up the one he wants.
I've changed whats like this:
W = what(path); % Use WHAT to get the files we want.
nb_what=length(W); % TD
disp(sprintf('%s directories were found: (click to display whats)',num2str(nb_what)));
disp(sprintf('<a href="matlab:whats(''%s'')">%s</a>', W(i).path, W(i).path));
A new version has been submitted which addresses the request of Dan Mac and the bugs report of Thierry.
Brings an error if what finds several directories.
Thanks Dan Mac.
Update will be submitted.
I like it. There is one suggestion (really simple change) that I would suggest and that is in line 97. I would suggest that "'\'" be changed to "filesep" for compatability with other OSes.
very(!) useful snippet meticulously following all help/coding standards; should replace ML's stock function WHAT...
in addition, programmers can easily extend its functionality by adding other file types...
For some odd reason, neither the pic nor the file updated when I added the FIG-Files to the list. Only my description changed! I will try again.
I was asked to add figure files to the listing.
Clicking on the names would open the figure.
I will update WHATS to do so.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!