f



Help with Parallel Matlab

Long story short, here is the criteria I need.
1) I need two modules running in parallel. One function must activate these two They don't need to START at the same time but both neither return info nor end. They run pretty much infinitely
1.1) I would prefer if the One function also ran separate from the above two in it's own loop but i can deal with a 3'rd function also not ending.

2) I need a shared variable between two of the modules. 1 Module will place information there while the other just reads it, but as they are running parallel.

That's it. I can do this in pretty much any other language but matlab I've been having issues with. Problem is I absolutely need to use matlab for one module.

If this is impossible to accomplish all in matlab then can i instead run this in C and call one matlab module with separate thread?

Sample code below.
function mainParallelTest()
persistent counter;
counter = 0;
parfor i=0:2
    
   if (i == 0)
       ImageProccessorParallelTest();
   elseif(i == 1)
       EventProcessorParallelTest();
   elseif(i == 2)
       prevCounter = 0;
        tempCounter = 1;
       while(true)
           tempCounter = counter;
           if (tempCounter == prevCounter)
               %disp('hi')
           end    
           prevCounter = tempCounter;
       end
   end
end
0
Alex
3/22/2016 6:19:03 PM
comp.soft-sys.matlab 211266 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
543 Views

Similar Articles

[PageSpeed] 16

"Alex Cruikshank" <cruiksam@gmail.com> writes:

> Long story short, here is the criteria I need.  
>
> 1) I need two modules running in parallel. One function must activate
> these two They don't need to START at the same time but both neither
> return info nor end. They run pretty much infinitely 
>
> 1.1) I would prefer if the One function also ran separate from the
> above two in it's own loop but i can deal with a 3'rd function also
> not ending.
>
> 2) I need a shared variable between two of the modules. 1 Module will
> place information there while the other just reads it, but as they are
> running parallel.

The primary mechanism for communicating between MATLAB workers executing
in parallel is labSend and labReceive - which operate within an SPMD
block. It sounds like you might want to do something a little bit like
this. In this example, worker 1 sends 'work' to workers 2 and 3, and
then gets them to quit by sending them empty 'work'. Workers 2 and 3
just consume work until there's no more.


parpool('local', 3);
spmd
  if labindex == 1
    for idx = 1:2:100
      labSend(idx, 2); % send work to 2
      labSend(idx + 1, 3); % send work to 3
    end
    labSend([], 2); % tell 2 to quit
    labSend([], 3); % tell 3 to quit
  elseif labindex == 2 || labindex == 3
    % here 2 and 3 are responding to 'work' in the same way.
    done = false;
    results = {};
    while ~done
      work = labReceive(1);
      if isempty(work)
        done = true;
      else
        results{end+1} = max(abs(eig(rand(work))));
      end
    end
  end
end
      
Cheers,
Edric.
0
Edric
3/23/2016 12:55:34 PM
Reply:

Similar Artilces:

parallel matlab
Hi all, I'm going to work on a project involving a parallel version of MATLAB - I'm aware of various efforts like MATLAB-*P and so on Right now I need to read up on some material regarding MATLAB internals eg: How are the ATLAS(or is it BLAS) routines called in MATLAB? How does MATLAB's C code store information in memory, cache'ing etc? How is one to get at those? Do you know of any suitable reference(s)/resource(s)? Thank you very much, Aravind ...

how could i use the matlab help without running matlab?
sometimes i just want to see some content of the help files and not intend to use matlab itself but as we know i must start matlab software first, then open the help product can i simply open the help document without running matlab? thanks! "fangfines " <fangfines@qq.com> wrote in message <i67kgh$qcr$1@fred.mathworks.com>... > sometimes i just want to see some content of the help files and not intend to use matlab itself > > but as we know i must start matlab software first, then open the help product > > can i simply open the help document without running matlab? > > thanks! Hi, The MATLAB help for the current release (R2010b) is available over the web. Choose a product such as the Signal Processing Toolbox. http://www.mathworks.com/products/signal/ and then under Support and Training, select the documentation. http://www.mathworks.com/help/toolbox/signal/index.html Wayne "Wayne King" <wmkingty@gmail.com> wrote in message <i67rfa$3bl$1@fred.mathworks.com>... > "fangfines " <fangfines@qq.com> wrote in message <i67kgh$qcr$1@fred.mathworks.com>... > > sometimes i just want to see some content of the help files and not intend to use matlab itself > > > > but as we know i must start matlab software first, then open the help product > > > > can i simply open the help document without running matlab? > > > > thanks! > > H...

help matlab help
how to automatical digitise profile to generate a vector model of the profile and how to use the digitised profile to sweep generate a graphical three dimensional model of the picture please give me some example ...........thanks very much..... ...

Need help for a matlab mini project
Hello everyone, I have a matlab in class exercise due in few days. I am new to matlab and the instructions provided with the assignment is minimal. Can Someone help me with the basic understanding as in how can I map the problem's solution to matlab script ? I am not able to post question here as it is a jpeg file. Please let me know and then we can discuss further. ...

urgent help needed: serial transmission from matlab to matlab
hi. really need help. i've to transmit an image serially between two computers using matlab on both transmitting and receiving ends. i've encoded the image into binary. been facing problems with the transmission when i used the command fprintf. when i executed that, i got a warning saying timeout occurred before terminator was reached. plus the receiving matlab hangs. i was told to save the binary packet into m-files then transmit the file over. how do i do that? is there a command to save and retrieve binary packets into and from m-files? i really need to get this done asap.thank you....

Trying to import multiple images into MATLAB and treat them as frames and overall help with matlab
Hello.I'm in desperate need of some help here, I want to import various images of clouds taken about 30 seconds in one another as a single video file the loop I used to originally do this consisted of: files = dir(Directory of files) for i = 1:100 str = strcat('Directory for workspace',files(i).name); clouds(i,:,:,:)=imread(str); end; But the images it produced were 4-d uint 8 and i was unable to read them or work with them at all. Please can you offer me some type of solution. The main goal of these processed cloud images is to be able to track the movement of clouds in the skys so if you have any demos that I could look at please post them On 28/12/10 8:49 PM, Linus Hamann wrote: > Hello.I'm in desperate need of some help here, I want to import various > images of clouds taken about 30 seconds in one another as a single video > file the loop I used to originally do this consisted of: > files = dir(Directory of files) > for i = 1:100 > str = strcat('Directory for workspace',files(i).name); > clouds(i,:,:,:)=imread(str); > end; > > But the images it produced were 4-d uint 8 and i was unable to read them > or work with them at all. Please can you offer me some type of solution. > The main goal of these processed cloud images is to be able to track the > movement of clouds in the skys so if you have any demos that I could > look at please post them That looks okay to me, except that it...

Help!Matlab to PIC interface via parallel port
I wan to send digital signal from Matlab to my microcontroller via parallel port. I wan the Matlab to send a short pulse to my PIC thru parallel port to trigger my PIC interrupt. At the same time , the parallel port oso send constant digital signal to my PIC port so that my PIC can do comparison So, its like , D0 - send short pulse like 100ms long to trigger my PIC interrupt D1~D7 -send data signal to PIC port. I am total newbie in Matlab and I oni know how to do the D1~D7 part and I'm totally have no idea how to do the short pulse part. Any1 can help me on this ? plzzzz.... ...

Matlab help !
Can any1 help me in matlab for image processing using blind deconvolution algorithm ...

Matlab Help!!!!!!!!!!!!!!!
Dear All I am working in project using matlab gui... I finished them and run prefectly. Then I used Matlab Compiler to change to stand-alone C application and all my file works perfectly ..... except one give me error and I could not figure out what the hell is the problem!! Here are the errors: I use ==> mcc -g -B sgl rx_gui.m Error rx_gui.c 102: Type mismatch in redeclaration of 'system' Error C:\BC5\INCLUDE\stdlib.h 353: Earlier declaration of 'system' Error rx_gui.c 4356: Two operands myst evaluate to the same type in function Mrx_gui_rx_gui_OpeningFcn MBUILD.BAT...

Help with matlab.
I'm failry new at matlab, and I was wondering if anyone could help me figure out a problem I have. I have the following assigned values: i=1:500; j=122+i; k=j+1; l=i+1; What I want is to display my anwers in 4 columns, i j k l, and also somehow delete each line with a specific i value. For example I don't want every 5th value of i, so when I get my results 5,10,15 etc. of i j k l would not display in my answers. Thank you all for your help. In article <ef57c22.-1@webcrossing.raydaftYaTP>, Franco Alvarez <emgineering@gmail.com> wrote: >I'm failry new at matlab, and ...

Help for Matlab!
Hi everyone! I hope you can help me with my probem. I want to reduce noise from a speech signal using an FIR Wiener filter. I am using the Wiener- Hopf equation to get the filter parameter, and in this equation, we need to compute autocorrelations ( or power spectrum). But first, I want to window my speech signal using 256 size windows. I only succeded in writing a matlab program that windows my signal in consecutive windows( a 256 window after a 256 window..etc). My problem is that I want the windows to partially overlap: That the second 256n window starts after 100 samples from the beginning...

Calling Compiled MATLAB from MATLAB
Hello everyone, How do I compile MATLAB M files into a form that can then be called from within the MATLAB interpreter? A roundabout way would seem to be to (somehow) Turn the matlab code into C (I think mcc does this), then compile this C code into MEX format and call that. Is there an easier way? I have the MATLAB compiler, so I just need to know what to do with it to get this to work. Thanks in advance, Sina sina.tootoonian wrote: > > > Hello everyone, > > How do I compile MATLAB M files into a form that can then be called > from within the MATLAB interpreter? A roundabout way would seem to > be > to (somehow) Turn the matlab code into C (I think mcc does this), > then > compile this C code into MEX format and call that. Is there an > easier > way? I have the MATLAB compiler, so I just need to know what to do > with > it to get this to work. > > Thanks in advance, > > Sina > > HELP MEX > HELP MEX Or, better, HELP MCC help pcode pseudo code is useful to obfuscate code - protect algorithms, yet still run at full speed and be distributable to other matlab users sina.tootoonian wrote: > > > Hello everyone, > > How do I compile MATLAB M files into a form that can then be called > from within the MATLAB interpreter? A roundabout way would seem to > be > to (somehow) Turn the matlab code into C (I think mcc does this), > then > compile this C code into MEX format and call that...

Help in matlab
Hi, I am a beginner of using matlab. I am now doing a project about cancer detection in matlab. I've got 120 samples which have classified as tumor or normal cells from patients. For each sample, there is 19200 parameters which are gene information of the cell. My objective is to find the best combination of parameters to classify the sample whether it is tumor or normal. Can anyone teach me how to do this? thanks very much cyly <ynlee519@hotmail.com> wrote in message <430718512.15579.1277718307555.JavaMail.root@gallium.mathforum.org>... > Hi, I am a beginner of usin...

Matlab Help?
I have been given an assignment and have no idea where to start. Please Help!!! 1. Open humpty_mixed.gif (2D image) and do what all of the king’s horses and men could not do – put humpty back together again. The image is 600x412 and split evenly along the rows and columns. (Note: We may use the imread(), imshow(), and imwrite() commands here.) * The picture is a scrambled picture of humpty dumpty that I am supposed to unmix. 2. Open humpty.jpg (3D image) and section off old humpty such that the top?half is red, bottom?left is green, and bottom?right is blue. For the top?half, force al...

matlab help
Hello guys i have to control 4 wheels by 4 dc motor through matlab. i am newbee in matlab, also i have to make respective GUI, how to proceed.. aditya wagh <adipatil110@gmail.com> wrote in message <4999e3da-44a3-463b-bc16-fcc521231536@googlegroups.com>... > Hello guys i have to control 4 wheels by 4 dc motor through matlab. > i am newbee in matlab, also i have to make respective GUI, how to proceed.. Start here: <<http://www.mathworks.com/help/matlab/getting-started-with-matlab.html>> ...

matlab help
hi i am student and I need help in one part of a homework... the problem is: Implements a function of birth to two sets of training classes accordance with the following specifications: each set consists of education vectors from two characteristics are among the statistically independent and the feature follows the normal distribution. The four average prices and price dispersion are four arguments as the entry-related ing. Moreover, the function receives the number of entry points for each class, even M1 and M2. The function returns two tables, measuring 3 × M1 and 3 × M2, wher...

Matlabe Help
I am trying to minimize the following loglikehood function and would like your help in matlab code thanks alot r(t) = a0 + a1 * r(t-1) + e(t), e(t) = (0, SD(e)) and n=N(0,1) e(t) = h(t)^0.5 * n(t) or n(t)= e(t)*h(t)^-0.5 h(t) = b0 + b1 * e(t-1)^2 + b2 * h(t-1)^2 s(t) = c0 + c1 * n(t-1)^3 + c2 * s(t-1) k(t) = d0 + d1 * n(t-1)^4 + d2 * k(t-1) LLF = -0.5 * log(h(t)) - 0.5*n(t)^2 + log(psi(n)^2) - ln(gamma(t)) psi = 1 + s(t)/6 * (n(t)^3 - 3*n(t)) + (k(t) - 3)/24 * (n(t)^4 - 6* n(t)^2 +3) gamma(t) = 1 + s(t)/6 + (k(t) - 3)^2 / 24 what am doing wrong? file 1. sk.m function [parameters, l...

Matlab plots outside Matlab
I'm making an end-user application where I would like to use Matlab functionality both for calculation and plotting. Matlabs GUI builder guide does not satisfy my needs (no support for f.ex. internal frames and other nescessities), so I'm planning to compile my Matlab code and use other API (Java, QT or something) for GUI. My problem is then, that I loose access to the neat plotting commands availible under matlab GUI... Is there a way of integrating Matlabs plot functionality into another GUI system? - has it been done? - I appreciate any response! - P�l Berge ...

Help in Matlab...
Hello Dear; I’m a programmer and developer of applications in Matlab with more than 5 years of experience and I offer services. Development projects and work on issues of science and engineering (mechanical, hydraulic systems, civil, industrial, environmental, chemical, electrical, electronics, physics, mathematics, statistics, ...) using programming software and graphical display as Matlab. I teach courses, seminars, trainings, workshops and virtual programming and graphic display of Matlab, the courses are mainly oriented to signal and image processing, numerical methods, statistics and general data processing, development and automation of processes and systems through implementing various types of models. Besides providing advice and assistance in developing all kinds of university-level technical and scientific environmental and physical sciences, mathematics and statistics related to Matlab (implementation of functions, encryption code, programs, script, GUI, executables ...). The service costs are negotiable, 50% at the beginning and 50% to finish the job. To contract and information: E-mail: correa.dave30@gmail.com Blog: http://fismatlab.blogspot.com/ Dave <correa.dave30@gmail.com> wrote in message <1706039780.58322.1280963817173.JavaMail.root@gallium.mathforum.org>... > Hello Dear; > > I&#8217;m a programmer and developer of applications in Matlab with more than 5 years of experience and I offer services. > > Development p...

Parallel Matlab
Hi everyone, We are interested in using Parallel Matlab over a Linux cluster. But, Math works doesn�t support Parallel Matlab. And we don�t want to use a Beta version or a temporarily solution. I would appreciate any suggestion or reply on this. Regards, Vinay. i'm sure you perused this: <http://supertech.lcs.mit.edu/~cly/survey.html> us vinay wrote: > We are interested in using Parallel Matlab over a Linux cluster. ...

help matlab
Devo svolgere con matlab problema di equazioni differenziali con eulero trapezi usando function e non la funzione ODE!... Grazie anticipatamente L.M. i need to resolve with matlab differenzial equation with eulero (trapezi) method without use ode functin. i need just use simple matlab function. t u L.M. "lorenzomaccioni@hotmail.com" wrote: > > Devo svolgere con matlab problema di equazioni differenziali con > eulero trapezi usando function e non la funzione ODE!... > Grazie anticipatamente > L.M. > > i need to resolve with matlab differen...

Dear All, I am completely new to MATLAB and the digital world. Could anyone help me with my following query. What are the methods used to implement a filter from an fdatool design in MATLAB
Dear All, I am completely new to MATLAB and the digital world. Could anyone help me with my following query. What are the methods used to implement a filter from an fdatool design in MATLAB On Wed, 13 Feb 2013 21:39:17 +0000, savina wrote: > Dear All, I am completely new to MATLAB and the digital world. Could > anyone help me with my following query. What are the methods used to > implement a filter from an fdatool design in MATLAB (...as well as 'completely new' to writing a compact subject line.) Depends on what you mean by "methods". If you launch the FDA tool, a 'la: > fdatool ....and look near the bottom of the GUI, you should see quite a lot of information on available filter synthesis options. ...

Matlab
Hello , I'm a new user in Matlab. So should you advise matlab notes , documentation please ? <azatserver113@gmail.com> wrote in message news:7b4e75e2-40c6-43bb-acc6-2553123ba649@googlegroups.com... > Hello , > > I'm a new user in Matlab. So should you advise matlab notes , > documentation please ? > At the MATLAB command prompt type this command: doc This will show the documentation included as part of your installation. I recommend reading through the Getting Started section of the MATLAB documentation first, and executing the examp...

matlab
any one please can help me sploving the following question 1________Given the causal system y[n] =3D 0.9y[n-1] + x[n], find H(z) and sketch the pole-zero plot. See the functions roots.m and zplane.m. 2___ Plot the magnitude and phase of H(z) on the frequency axis from 0 =E2=80=93 =EF=81=B0, or normalized frequency 0 - 1, and label the graphs. S= ee the freqz.m command. hani_al_yazidi@hotmail.com wrote: > any one please can help me sploving the following question > > > 1________Given the causal system > > y[n] = 0.9y[n-1] + x[n], > > find H(z) and sketch the pole-zero plot. See the functions roots.m and > zplane.m. > > 2___ Plot the magnitude and phase of H(z) on the frequency axis from 0 > – , or normalized frequency 0 - 1, and label the graphs. See the > freqz.m command. It looks like homework. State what you tried and what error messages you got and someone who knows Matlab will probably help. We try not to do homework here, but (like gods) we do help those who help themselves. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯&...

Web resources about - Help with Parallel Matlab - comp.soft-sys.matlab

Parallel - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

The parallel universe of Donald J. Trump
Within days of the launch of Donald J. Trump's presidential campaign last June, he entered a parallel universe of his unique creation – a universe ...

The parallel universe of Donald J. Trump
Within days of the launch of Donald J. Trump's presidential campaign last June, he entered a parallel universe of his unique creation &ndash; ...

Buy Parallels
Starting today, Parallels is offering a new bundle for a limited time that will let you get 81% off 7 great Mac apps with the purchase or upgrade ...

Kindle for iOS gets social sharing features, parallel downloads
... it is nevertheless nice to see Amazon take advantage of Apple’s mobile platform through integrating sharing in this way. Kindle for iOS. Parallel ...


Scandal over South African president draws Nixon parallel
JOHANNESBURG (AP) — Speaking in an old fort and prison from South Africa's era of white domination, a former anti-apartheid leader hinted that ...

Trust and Democracy: The Odd Parallels between Trump and Apple
... Apple in its fight against the FBI and Justice Department wouldn’t be caught dead voting for Trump. And yet Apple’s position has some odd parallels ...

Trade Policy Parallels
It’s not surprising at all, I think. Both Bernie and Trump belong to the rebels, the outsiders. The establishment on both sides is trying to ...

Parallels Updates Remote Application Server for PCs, Macs
Parallels Remote Application Server v15 brings Windows applications and desktops to employees on any device, anywhere in the world.

Resources last updated: 3/22/2016 7:14:19 PM