diff --git a/packages/matlab-snippets/0.1.0/README.md b/packages/matlab-snippets/0.1.0/README.md new file mode 100644 index 0000000..afb4c90 --- /dev/null +++ b/packages/matlab-snippets/0.1.0/README.md @@ -0,0 +1,20 @@ +## MATLAB Snippets +A small package for [espanso](https://espanso.org/) with triggers for headers and code snippets I constantly use in [MATLAB](https://www.mathworks.com/products/matlab.html?s_tid=hp_products_matlab). Feel free to use and modify any of these as you see fit. + +### Global Variables: + myName + Global variable for your name. Make sure to change to your name or username. Can be replaced in the headers with any pre-existing variables that have your name. + +### Triggers: + :matHead + Generic header form with spaces to enter the file name, a summary and any collaborators. + :matFunc + Generic Function header with blanks to enter the function name, a summary and any collaborators. + :matPlot + Code snippet with basic commands used when making a plot. Saves figure to a variable that can be used to reopen, modify and print a plot. + :matPrnt + Code snippet for printing out MATLAB figures (.fig). Uses the name assigned to a variable as seen in :matPlot + :matData + Code snippet for loading multiple files from a folder into a structure. + +Last Updated: 08/19/2024 \ No newline at end of file diff --git a/packages/matlab-snippets/0.1.0/_manifest.yml b/packages/matlab-snippets/0.1.0/_manifest.yml new file mode 100644 index 0000000..359d683 --- /dev/null +++ b/packages/matlab-snippets/0.1.0/_manifest.yml @@ -0,0 +1,6 @@ +name: "matlab-snippets" +title: "MATLAB Snippets" +description: Headers and code snippets for use in MATLAB +version: 0.1.0 +author: MistressOfUniverses +tags: ["v0.1.0". "matlab". "snippets". "espanso"] diff --git a/packages/matlab-snippets/0.1.0/matlab-snippets.yml b/packages/matlab-snippets/0.1.0/matlab-snippets.yml new file mode 100644 index 0000000..8686da0 --- /dev/null +++ b/packages/matlab-snippets/0.1.0/matlab-snippets.yml @@ -0,0 +1,67 @@ +# Global Variables +global_vars: + - name: myName + type: echo + params: + echo: "Your Name Here" + +matches: + # Headers + # Generic Header + - trigger: ":matHead" + form: | + %% [[fileName]] - Main + % [[Summary]] + % + % Author: {{myName}} + % Collaborators: [[Collaborators]] + % Last Modified: :date + + % Start Code + clc; clear all; close all; + form_fields: + text: + multiline: true + + # Function Header + - trigger: ":matFunc" + form: | + function [] = [[funcTitle]]() + %% [[Summary]] + % + % Author: {{myName}} + % Collaborators: [[Collaborators]] + % Last Modified: :date + % Inputs: + % + % Outputs: + % + % Methodology: + + end; + form_fields: + text: + multiline: true + + # MATLAB Specific Code + # Basic Plot Template + - trigger: ":matPlot" + replace: | + % figure() + figure(); hold on; grid on; grid minor + plot(); + title(); xlabel(); ylabel() + hold off; + + # Print Graphs + - trigger: ":matPrnt" + replace: "print( ,'-dpng','title.png')" + + # Load in Data + - trigger: ":matData" + replace: | + files = dir('FolderName/'); + for temp = 3:4 + long_name = strcat(files(temp).folder,'/',files(temp).name); + raw_data.(files(temp).name) = readtable(long_name); + end