How to close MATLAB editor window/windows using command? [duplicate] - matlab

This question already has answers here:
How to close one or all currently open Matlab (*.m) files from Matlab command prompt?
(2 answers)
Closed 4 years ago.
I want to know if there is any way to close the editor window (like function, script)using Matlab command.

Step 1. Get the editor service
editor = com.mathworks.mlservices.MLEditorServices; % main editor service
Step 2. Choose either of following depending on your requirement
editor.getEditorApplication.close; % Close editor windows (with prompt to save)
editor.getEditorApplication.closeNoPrompt; % Close editor windows

Related

Use Vim to edit Simulink blocks

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.

Matlab: how to stop command window printing? [duplicate]

This question already has an answer here:
How to abort a running program in MATLAB?
(1 answer)
Closed 7 years ago.
Sometimes I accidentally print a say 5000x5000 matrix, which takes a long time. How can I stop the command window from printing?
I am using Matlab R2015a on a Mac. Thank you very much.
On a Windows machine, it's Ctrl + C. This stops executing code as well as printing. I assume it is comparable on a Mac: Ctrl + C.
On a mac it's
CTRL+C
Sorry for the short and not very appealing answer.
clc to clear the command window, ctrl+c to stop execution and ; at the end of the line you don't want to print will suppress the command window output.

List of functions used in a Matlab script [duplicate]

This question already has answers here:
How can I generate a list of function dependencies in MATLAB?
(2 answers)
Closed 8 years ago.
Is it possible to obtain a list of the user-supplied functions (functions which are not Matlab toolbox functions) called by a Matlab script?
Yes. In the MATLAB Current Folder window, navigate to the folder containing your script. Right-click on the background of the window, and select Reports->Dependency Report. You should get a nice report detailing the dependencies of all the files in that folder.
You can achieve roughly the same result programmatically with the command depfun, or since version 2014a, matlab.codetools.requiredFilesAndProducts.

Program that gets x and y coordinates in a MATLAB GUI when clicked [duplicate]

This question already has an answer here:
Running ginput while also running a loop in MATLAB
(1 answer)
Closed 8 years ago.
I need a program that will run without all of the time without pausing to wait for a click. The program should save the x and y coordinates of the click into a variable.
You need to set the ButtonDownFcn of the axis, and then, in that function access and store the eventdata variable, wihch is a [1x2] double of the clicked coordinates.
It's hard to give you much of an answer with out more details...

MATLAB: how to get the list of figures [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I get the handles of all open figures in MATLAB
The situation is following. I run a couple of tests, which plot a lot of figures. I would like to convert them to pdf and compile into one file. Since each time I may get different type of plots and different number of plots, I need to get the list of all figures in current matlab session or workspace. Is this doable?
Thanks
h = get(0,'Children');
will put the "handles" to the figures you currently have in the variable h. get(handle) and set(handle,...) are gigantically useful in general. The handle 0 points at the root of the display, so all the figures on the display are the root's Children.