-
Notifications
You must be signed in to change notification settings - Fork 12
Setup
- obviously you need Matlab. I only use the currently
newest availableR2021a Matlab version, this includes pre-releases. - you need to download the matconsolectl package here https://mvnrepository.com/artifact/com.diffplug.matsim/matconsolectl/4.5.0 (is included in download page).
matconsolectl: All code up to tags/original: Copyright (c) 2013, Joshua Kaplan)
- the package was changed in Version 1.11 from
at.justin.matlab
toat.mep
- be reminded, this is a "hobby" project I need for work, so after some time I forget about things I've done and should do. So when I'm updating and changing the code, things might break apart except the ones I personally use the most (e.g. the installer is probably the least used function). Which leads me to unit tests.
- download the jar files from the latest release (V1.25). Make sure that there is only one of each jar file in destination folder.
- execute
MEP_V####.jar
or follow the Manual Installation if the installer does not work.
broken
- red means location is invalid either one or both
*.jar
files orjavaclasspath.txt
is not found. - browse to the location of
*.jar
files, or thejavaclasspath.txt
- if there is no
javaclasspath.txt
typewinopen(prefdir)
and create ajavaclasspath.txt
file (Matlab Help and More Help).
- if there is no
- choose an installation directory for MEP
- It may be necessary to manually remove Matlab's shortcut for Bookmarks (
preferences>Matlab>Keyboard>Shortcut>Set/Clear Bookmark
). On some systems the bookmark viewer and storage does not work when the shortcut is used within Matlab.
Alternatively you can run it via command line (not before V1.35)
The first argument is the path to the folder containing both .jar
files. The second argument is the path to javaclasspath.txt
and the third argument is the installation directory.
java -jar .\MEP_1.35.jar "C:\...downloads" "C:\...\javaclasspath.txt" "C:\...\MEP"
The Installer will copy both *.jar
files and *.properties
to desired location and will modify the javaclasspath.txt
accordingly.
-
Copy both jar files to desired location (must be a user-writable folder) e.g.
%appdata%\MathWorks\MATLAB\R2020b\MEP\
-
Open
MEP_*.jar
with any archive viewer (e.g. 7zip).- copy
DefaultProps.properties
from properties folder and insert it in the same folder as the*.jar
files. - copy
DefaultProps.properties
and rename it toCustomProps.properties
. - to enable live templates follow the instructions found here (optional)
- to enable local history follow the instructions found here (optional)
- copy
-
Type
edit javaclasspath.txt
in matlab and add both of*.jar
filesC:\...\matconsolectl*.jar C:\...\MEP*.jar
-
optionally you can add them dynamically with
javaaddpath('C:\Programme\Matlab\MEP\*.jar')
, just make sure to add matconsolectl before MEP) -
if there is no javaclasspath.txt type
winopen(prefdir)
, create ajavaclasspath.txt
file (Matlab Help and More Help).MatLab documentation
Create javaclasspath.txt File Each line in the javaclasspath.txt file contains a reference to a Java class folder or JAR file. To create the file:
-
Create an ASCII text file named javaclasspath.txt.
-
Enter the name of a Java class folder or JAR file, one per line. The format of the name depends on how the class is defined.
- For classes defined in Java packages, see Add Packages.
- For classes defined in individual .class files, see Add Individual (Unpackaged) Classes.
- For classes defined in Java Archive (JAR) files, see Add JAR File Classes.
-
Simplify folder specifications in cross-platform environments by using the $matlabroot, $arch, and $jre_home macros.
-
Save the file in your preferences folder. To view the location of the preferences folder, type:
prefdir
Alternatively, save the
javaclasspath.txt
file in your MATLAB startup folder. To identify the startup folder, type pwd at the command line immediately after starting MATLAB. Classes specified in thejavaclasspath.txt
file in the startup folder appear on the path before classes specified in the file in the preferences folder. If a class appears in more than one folder or jar file, then Java uses the first one it finds. -
Restart MATLAB.
-
-
-
Manually remove Matlab's short cut for Bookmarks (
preferences>Matlab>Keyboard>Shortcut>Set/Clear Bookmark
), and set desired short cut in.properties
file- the removal might not be necessary. On some systems it conflicts with MEP and the shortcut won't work)
-
restart Matlab (if static path was chosen)
-
continue with the sections below
If you want to start this plugin on every startup of Matlab you have to modify startup.m
. Add the following:
at.mep.Start.start('C:/.../CustomProps.properties', ...
'C:/.../DefaultProps.properties');
Optional - Configuration
Examples
create MyKeyReleaseFunction.m
in Matlab's search path
function out = MyKeyReleaseFunction(actionEvent)
if nargin == 0; out = []; return; end
% this is necessary, the first thing happen is trying find out whether
% the passed function is a valid matlab function or not
% assignin('base','actionEvent',actionEvent)
fprintf('ALT + INSERT\n')
out = 1;
- I strongly advise you not to debug these functions via keyboard command (matlab will most likely freeze). Instead call it from command line. If you need access to
actionEvent
useassignin('base','actionEvent',actionEvent)
after that go to your startup.m
file and add these lines
import at.mep.util.*;
import at.mep.editor.*;
ctrl = true;
shift = true;
alt = true;
ks_MyKeyReleaseFunction = KeyStrokeUtil.getKeyStroke(java.awt.event.KeyEvent.VK_INSERT, ~ctrl, ~shift, alt, false);
EditorApp.addMatlabCallback('MyKeyReleaseFunction', ks_MyKeyReleaseFunction , 'MyKeyReleaseFunction');
Your startup.m
should look like something like this:
% MEP-Startup (necessary)
at.mep.Start.start('C:/.../CustomProps.properties', ...
'C:/.../DefaultProps.properties');
% -~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=-~=
% Custom keyboard Shortcuts (Optional):
import at.mep.util.*;
import at.mep.editor.*;
ctrl = true;
shift = true;
alt = true;
% Example Shortcut
ks_MyKeyReleaseFunction = KeyStrokeUtil.getKeyStroke(java.awt.event.KeyEvent.VK_INSERT, ~ctrl, ~shift, alt, false);
EditorApp.addMatlabCallback('MyKeyReleaseFunction', ks_MyKeyReleaseFunction , 'MyKeyReleaseFunction');
For a complete list of Keyboard Constants follow this link: docs KeyEvent
Use VK_META
instead of VK_CONTROL
if you're on a MAC #150 (correct me if i'm wrong, i have zero experience regarding MACs).
- Type
edit javaclasspath.txt
and remove the lines containingMEP_*.jar
andmatconsolect*.jar
. - remove necessary lines from
startup.m
- close Matlab
- remove files from installation folder
Contact: [email protected]