how run two codes at the same time from GUI?

2 views (last 30 days)
nada ali
nada ali on 18 Feb 2014
Commented: nada ali on 19 Feb 2014
*Hi,
How I can open two copies of matlab in my computer automatically.
In fact, I have two codes I would to run it at the same time. What I need is running the two codes in parallel from GUI automatically.
I need when press the a button, the two codes are running at the same time together.
Thanks*

Answers (1)

Iain
Iain on 18 Feb 2014
The best you can probably sensibly do is just use parallel computing.
Something like
parfor i = 1:2
if i == 1
result(i) = runcode1(input(1))
else
result(i) = runcode2(input(2))
end
end
  2 Comments
nada ali
nada ali on 18 Feb 2014
thanks I think this code do not run the two functions at the same time. Right?
I think , two workers have to work together , hence two windows have to be opened. please, I need more help Anyway, I try my two functions:
parfor i = 1:2
if i == 1
result(i) = seq_alignment();
else
result(i) = seq_alignment_c();
end
end
this is what I got %%%%%% In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in ==> phd>(parfor body) at 98 result(i) = seq_alignment_c();
Error in ==> parallel_function at 475 consume(base, limit, F(base, limit));
Error in ==> phd>pushbutton11_Callback at 92 parfor i = 1:2
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> phd at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)phd('pushbutton11_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
nada ali
nada ali on 19 Feb 2014
Thank u so much it is working now and the time is less I just add matlabpool open local 2
I just want to ask if I can show the processing in two windows(2 workers) because I show it in one window.
thanks

Sign in to comment.

Categories

Find more on Parallel Computing in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!