Use Vim to edit Simulink blocks - matlab

When I click on a function block in Simulink, it's Matlab code is opened in Matlab editor. I don't like it. I'd rather use Vim.
I tried changing editor in Matlab Preferences (Home->Environment->Preferences-> Editor/Debuger). I switched editor from "MATLAB Editor" to C:\Program Files(x86)\Vim\vim80\vim.exe.
But that makes vim open only when I type "edit" command in command line.
Using Matlab R2014b under Windows 7.

Related

Print text (disp, fprintf...) to the command MATLAB window in Labview

Is there a way I can print to the Labview MATLAB Command Windows?
disp and fprintf doesn't work.
Sample:
Create Labview vi
Add a "MATLAB script"
Write inside it: disp('Hello'); or MyFile; .m containg this same code.
Run code
Nothing is displayed in the "MATLAB Command Window"
MATLAB script window in LabVIEW dont support IDE functions of MATLAB. For example 'disp' is MATLAB own function to display some thing in command window. When calling from LabVIEW, we are not in MATLAB IDE.

matlab -nodesktop command history: cannot be saved

1 I run matlab without GUI, sometimes I would like to see commandhisoty by using commandhistory function, but I found that if I run matlab without GUI, the program cannot save any command history like the GUI matlab, are there some methods to solve this problem?
2 I tyied to use diary, but it seems that it can only save all commands and outputs. In addition, it seems that I should type diary every time when I open matlab, the default option is diary off. How to make it more convenient to use

How to run part(section) of matlab m flie in terminal? Like emacs Run region

I use matlab without GUI, I wonder how I can run part of the matlab codes in terminal.
I can run part of the codes in the default matlab editor.
reference:
matlab-emacs
http://www.mathworks.com/help/matlab/matlab_prog/run-sections-of-programs.html

Use Matlab PDE toolbox from command line

I would like to solve a PDE with Matlab PDE toolbox using only the command window of the system. I can create the problem and run the solver, but the PDE toolbox window pops up occaisionally and asks questions (e.g., "Do you want to save unsaved document?").
How can I avoid these popups or how can I use the PDE toolbox without opening its window?
I am using the following code. The window is pops up when I call the pdeinit function on the first line.
[pde_fig,ax]=pdeinit;
set(ax,'XLim',[-0.1 0.2]);
set(ax,'YLim',[-0.1 0.2]);
set(ax,'XTickMode','auto');
set(ax,'YTickMode','auto');
% Geometry description:
pderect([0 0.05 0.05 0],'R1');
pderect([0 0.1 0 0.1],'R2');
set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','R2-R1');
...
The help for pdeinit is short: "Start PDETOOL from scripts." pdetool, like most *tool M-files from The MathWorks, is a GUI and the help/documentaion for it indicates as much.
I'm confused because, not only does pdeinit open a figure window, but you're using it to return handles to the figure and axis of that figure. Your code then proceeds to manipulate those handles. You can't get those handles without first creating and opening a figure. Is the issue that you just want a regular figure window instead? If so, then you can replace [pde_fig,ax]=pdeinit; with:
pde_fig = figure;
ax = gca;
You can look at the code for pdeinit: type edit pdeinit in your command window. You'll see that all it does is open pdetool (unless it's already open) and return handles to the resultant figure and axis.
Additionally, pderect will open pdetool on its own. You're using a bunch of functions that are all tied to the PDE app. Many of the tutorials and examples on The MathWorks's site use this. You might check out this article on how to solve PDEs programmatically. The examples might also be helpful.

Refactoring variables and function names in MATLAB?

In eclipse you can refactor all variables and function names by hitting CTRL+SHIFT+R which is great. I am editing someone else's matlab script and would like to change a lot of their varaibles and I was wondering if there is something similar in matlab?
Matlab editor in 2012a allows you to press shift + enter to change all of the common variables in a script or function when you start editing one of them.
Otherwise I would suggest find and replace.