I am wondering what others use for those little short-cuts or niceties in MATLAB. I have in mind something you wrote or something somebody else wrote or an underused MW function.
Here are my two favorites.
This is a simple script I use. Here is the entire contents of CLC.m (yes, it is capitalized):
clear all,close all,clc
Very simple, but I use it all the time. Here is another one I use so often that I forget not every machine has it (though every machine should, IMO):
Here is an underused MW function that I occasionally employ when working on someone else's machine. The usual response is, "Wait, what did you just do?"
home
What are some of yours?
40 Comments
Time DescendingI'm a clumsy typist...
function hepl (x)
help (x)
end
@Sean, I have only the command window and a minimized command history open to the left of that space. No docked anything. I am old-school. That is why I like whats so much, one simple command and I can do it all and I don't have to keep any more panels open all the time. Let me know "what" you think if you try it.
Is there any way to make a shortcut button called something like "Format Code" which essentially does Control-A (to select all the text in the editor window) followed by Control-I (to fix up the indenting/alignment)? That's a nice set of utility commands that I use often.
@Matt, do you not keep the current directory panel open? I might have to give whats a try if it means I could close that panel.
I use uigetfile and uigetdir day in and day out, so when I am writing a new code I always add this code to the beginning of my function and I love it:
if isappdata(0,'previousDirectory')
startDirectory=getappdata(0,'previousDirectory');
if isnumeric(startDirectory)
startDirectory='C:\';
end
else
startDirectory='C:\';
end
[uigf1 uigf2]=uigetfile('*.bdf','SelectFile to Load',startDirectory);
setappdata(0,'previousDirectory',uigf2);
Simply saves my directory location so that I dont start at C:\MyDocuments|MATLAB every time.
I have a lazy shortcut to open the current folder I am working in
system(strcat('%SystemRoot%\explorer.exe',' "',pwd,'"'));
:)
I second home - its very useful, the number of times I've had to go to a colleagues screen to help them debug and they have typed clc thinking they are helping me start - but of course that clears the error and any messages on the screen....
My favourite - its not a snippet but a code I would struggle to do wihtout since I work on multiple project is my SaveEditorHistory FEX.
@Sean, I cannot get dbquit to be recursive, but adding the following makes it so calling it twice works
if feature('IsDebugMode')
disp('MATLAB was in debug mode, cll must be run a second time.')
dbquit('all');
end
Sign in to participate