LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Sync using Matlab modulation/demodulation scripts

Hello,

 

I've made a Vi which calls two matlab scripts at different frames. the first script generates a modulated signal and the second script adds a gaussian noise and demodulates the signal generated by the modulator. I've looped the script so that aleatory signals should be generated and demodulated continuously. However, it seems that the modulator is running at a much higher "speed" (the rate at which the demodulated signal are generated is much lower than the rate that other modulated signals are generated). It looks as if the first script doesn't wait the second script to finish to create another signal.

 

Any advices? thanks a lot

 

cheers,

 

0 Kudos
Message 1 of 2
(7,059 Views)
Hello,

Without seeing your VI, it's difficult to know exactly what you're doing.  I assume you have two separate MATLAB script nodes in different frames of a flat sequence or stacked sequence structure.  As long as your have your loop structure outside of the sequence structure, each node will execute to completion (as will the entire sequence structure) before commencing execution again.  Note that both nodes share the same execution environment in The MathWorks, Inc. MATLAB® software.  This may result in some conflicts if you are reusing variable names between the nodes.

If you are experiencing problems with one node running at a higher frequency than the other, then check these items:
  • Do you have any loops inside of the MATLAB script node?  This will cause one node to execute more often before finishing.
  • Do you have both MATLAB script nodes inside the same frame of the sequence structure without any wired dependency between them?  If so, LabVIEW may be parallelizing the execution of the nodes.  Still, one will not run at a higher rate than the other because they are still both inside a single loop structure.
  • Do you have a loop structure around each of the nodes individually without any wired dependency between them?  In this case, the nodes may be run in parallel and at different rates, exhibiting the behavior you're seeing.

Look at your code again and ensure that the two MATLAB script nodes are in separate frames of a sequence structure and that any loop structure is outside of the sequence structure.  If this does not help, please post your VI so we may get a better idea of how your code is structured.

MATLAB® is a registered trademark of The MathWorks, Inc.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 2 of 2
(7,047 Views)