MATLAB Environment Tweaks [closed]

随声附和 提交于 2019-12-02 20:47:14

I run "format compact" to remove all those frustrating blank lines spacing out my output. Oh so simple, but makes it so much nicer to me.

I use a function idetitle() that can change the window title of the Matlab GUI itself. Useful in a development environment where I'm running several Matlab processes, possible on different branches of source code or model runs. Sometimes I'll put the PID in the window title to make it easy to find in Process Explorer for monitoring resource usage.

function idetitle(Title)
%IDETITLE Set Window title of the Matlab IDE
%
% Examples:
% idetitle('Matlab - Foo model')
% idetitle(sprintf('Matlab - some big model - #%d', feature('getpid')))

win = appwin();
if ~isempty(win)
    win.setTitle(Title);
end

function out = appwin()
%APPWIN Get main application window

wins = java.awt.Window.getOwnerlessWindows();
for i = 1:numel(wins)
    if isa(wins(i), 'com.mathworks.mde.desk.MLMainFrame')
        out = wins(i);
        return
    end
end

out = [];

I changed the default font in the MATLAB editor to 10 point ProFont (which can be obtained here) so I could write code for long periods of time without giving myself a headache from straining my eyes.

I run Matlab with the options -nodesktop -nojvm. That way it just sits in a terminal out of the way, and I can use my favourite text editor to my heart's content.

You do miss out of some killer features this way though.

I set the number of lines in the command window scroll buffer to the maximum (25,000). This doesn't seem to noticeably affect performance and allows me to display a large amount of data/results.

I use a startup.m file (sits in the local MATLAB path) to make sure that I have the settings I want whenever I start up MATLAB. This includes such things as formatting the REPL and plot parameters.

I set the Command Window output numeric format to long g.

I implemented analogues of xlim and ylim: xlim_global([xmin xmax]) and ylim_global([ymin ymax]), which sets the axes' limits the same for every subplot in the figure.

I invert colors to have a black backgroud, easier on the eyes.

(Alt+Shift+PrintScreen on Windows, you can configure away the huge icons)

Scottie T

I keep a diary for each session (possibly multiple diary files per day) to recall all commands executed. This is controlled by a startup.m file that checks for previous diary files from that day.

I wrote a small function called fig.m to call up figure windows with names rather than numbers and display the name in the status bar.

Funnily enough, there are two or three identically named files that do exactly the same thing on the file exchange.

I have functions to 1) save the current figure locations and sizes on the screen, and 2) and one to load such configuration. It's very useful e.g. when monitoring data-heavy simulations.

I set shortcuts for

  1. open current directory
  2. up 1 folder
  3. an action to do 'close all; clear all; clc;'

Ref: http://www.mathworks.com/matlabcentral/fileexchange/19097-custom-panzoom-icons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!