Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Opening multiple MATLAB windows in PC

Subject: Opening multiple MATLAB windows in PC

From: Enfa White

Date: 12 Jul, 2013 07:44:08

Message: 1 of 5

May I open a few MATLAB windows in PC to run the same piece of program? Will it be of any conflicts to the results produced? I would like to run my program with different settings for each variable. So I create a universal template to enter different set of variables. I create a few files with different file names and open a few MATLAB windows to run the program. It is possible to do in such a way? Please advise.

Subject: Opening multiple MATLAB windows in PC

From: Nasser M. Abbasi

Date: 12 Jul, 2013 08:54:14

Message: 2 of 5

On 7/12/2013 2:44 AM, Enfa White wrote:
> May I open a few MATLAB windows in PC to run the same piece of program?
>Will it be of any conflicts to the results produced? I would like to run my
>program with different settings for each variable. So I create a universal template
>to enter different set of variables. I create a few files with different file names
>and open a few MATLAB windows to run the program. It is possible to do in such a way? Please advise.
>

yes, it is possible. The input to each function can be different.
  
It really comes down to this:

1. you have global variables
2. you have function level variables.

Global variables are things defined in the base workspace.

Variables created inside functions are in the function own workspace
and they do not interfere with either the base workspace
or other functions workspace. When a function returns, its
workspace is gone.

So, as long your variables are not global (not defined in the base
workspace) then you do not need to worry about conflict. In otherwords,
as long as your function has no side-effects, you are OK.

--Nasser

Subject: Opening multiple MATLAB windows in PC

From: James Tursa

Date: 12 Jul, 2013 15:52:06

Message: 3 of 5

"Enfa White" wrote in message <kroc48$j96$1@newscl01ah.mathworks.com>...
> May I open a few MATLAB windows in PC to run the same piece of program? Will it be of any conflicts to the results produced? I would like to run my program with different settings for each variable. So I create a universal template to enter different set of variables. I create a few files with different file names and open a few MATLAB windows to run the program. It is possible to do in such a way? Please advise.

I assume you are talking about starting up multiple sessions of MATLAB (i.e., clicking on the MATLAB icon multiple times to start the program multiple times). If so, the answer is yes (I do it all the time). Each session runs in its own address space and has no connection to any other sessions. All variables (even global ones) are in separate address spaces and will not affect other sessions. In fact you have to do something very exotic to force them to talk to each other ... it doesn't happen by default. If the sessions access the same *file* then they can walk on each other of course, but if you are using different file names for each session as you state then that will not be a problem either.

James Tursa

Subject: Opening multiple MATLAB windows in PC

From: Duy

Date: 21 Feb, 2014 06:39:09

Message: 4 of 5

Is there any Matlab function or command in order to determine that how many Matlab windows are opened ?

Thanks!

Subject: Opening multiple MATLAB windows in PC

From: Steven Lord

Date: 21 Feb, 2014 15:34:24

Message: 5 of 5


"Duy " <lduy@nippon-seiki.co.jp> wrote in message
news:le6sac$mlt$1@newscl01ah.mathworks.com...
> Is there any Matlab function or command in order to determine that how
> many Matlab windows are opened ?

Define what you mean by "Matlab windows" -- do you mean figure windows,
MATLAB sessions, desktop components, or something completely different?

For the figure window case, use FINDALL to find all objects of 'Type'
'figure' beneath the root object 0.

for k = 1:5
    figure(k);
end
findall(0, 'Type', 'figure')

For the MATLAB sessions case, you _might_ be able to parse the information
returned by the operating system's process listing functionality (TASKLIST
on Windows, PS on Linux and Mac) using the string processing functions in
MATLAB, but there's no functionality in MATLAB to obtain this list directly.

For the desktop component case, there _might_ be something you could do in
Java to find out but I'm not sure.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us