MATLAB Answers

Add a comment signature to a script with a shortcut.

1 view (last 30 days)
Kris Hoffman
Kris Hoffman on 5 Jun 2020
So, this might be an odd question, but I'd like to know if there's a way to add a comment line to an open script in matlab via keyboard shortcut or quick access toolbar button. There are a few people that work on one script and it's hard to tell who changed what. So to make it easier, it would be nice to have a way to quickly do this...
Original code:
function MarkerLabels(app)
if isempty(app.EventMarkers) % This will only apply if you browse for the same file.
cla(app.UIAxes2)
% If there are no markers, then clear the marker axes and
% reset the interface if there's no events stored in
% app.EventMarkers
app.PreviousMarkerButton.Enable = 'off';
app.NextMarkerButton.Enable = 'off';
...
Then press a key combo or toolbar button and apply a "signature" to the comment or line of code. Like this...
function MarkerLabels(app)
if isempty(app.EventMarkers) % This will only apply if you browse for the same file.
cla(app.UIAxes2)
% If there are no markers, then clear the marker axes and
% reset the interface if there's no events stored in
% app.EventMarkers % Added by KH June-05-2020 15:45CST (Friday)
app.PreviousMarkerButton.Enable = 'off';
app.NextMarkerButton.Enable = 'off';
...
I know how to make a quick access button to run code on the command line, but I want to place a signature in an open script file using something like
datetime
with some additional formatting.
Thanks

Answers (0)

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!