Skip to content

Instantly share code, notes, and snippets.

@sauravrt
Created February 22, 2014 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sauravrt/9158398 to your computer and use it in GitHub Desktop.
Save sauravrt/9158398 to your computer and use it in GitHub Desktop.
Script to open editor with skeleton code structure in MATLAB
function skeleton
% Script to open editor with skeleton code structure
% Skeleton taken from
% http://www.cs.utah.edu/~germain/PPS/Topics/Matlab/function_design_pattern.html
content = sprintf(strcat('function return_value = name_of_function( parameters ) \n', ...
'%% Author: \n', ...
'%% Date: ', date, '\n', ...
'%% Partner: \n', ...
'%% Function : Name of Function \n', ...
'%% Purpose : What task does the function accomplish \n', ...
'%% or what does it compute', ...
'%% Parameters : What values/types are expected as input?\n', ...
'%% Return : What comes out of the function?\n', ...
'%% Examples of Usage (say for a sort function):\n', ...
'%% >> grades = [ 95 52 95 80 71 85 78 12 93 99 ];\n', ...
'%% >> sorted_array = sort( array )\n', ...
'%% \n', ...
'%% ans = [ 12 52 71 78 80 85 93 95 95 99 ] % % \n'));
matlab.desktop.editor.newDocument(content);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment