how run two codes at the same time from GUI?

4 次查看(过去 30 天)
*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*

回答(1 个)

Iain
Iain 2014-2-18
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 个评论
nada ali
nada ali 2014-2-18
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 2014-2-19
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Parallel Computing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by