LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a random noise (Gaussian) using Matlab Script

Hello, Since I only have Labview 6.1 base, I can't use the white-noise generator in Labview. I'm thinking of using the Matlab Script. I have Matlab 2006R installed in the same computer. However, I tried running the program and nothing happened (I used the help example "a=rand(50);surf(a)" in the Matlab Script. Why it's not calling the Matlab, or is there a better way to create a Gaussian distribution in Labview 6.1 Base? Thanks a lot!
0 Kudos
Message 1 of 3
(12,293 Views)
Hello,

Why are you unable to use the Gaussian White Noise VI in LabVIEW 6.1?  It is under the Analyze >> Signal Processing >> Signal Generation palette.  I have attached a simple VI that illustrates creating a matrix.

If you wish to use the MATLAB® script node, let's first make sure it is working correctly.  Try opening one of the LabVIEW shipping examples.  Browse to <LabVIEW>\examples\scriptnode and open "HiQMATLAB_Fractal.llb."  Then open "MATLAB Fractal.vi."  Run the VI.  Do you get any error windows that pop up?  If not and you see a picture of a fractal appear, then the connection to the MATLAB software is working correctly.  In your VI, try creating an error out indicator from the MATLAB script node and see if any errors appear.

If you do see an error in the shipping example, it means there is a problem with the software connection.  Make sure that you have launched the MATLAB software at least once after you installed it.  This will set up the necessary connection information.  Then launch LabVIEW.  If this isn't the issue, we could try manually restoring the server commands.  Make sure LabVIEW and the MATLAB software are not running.  Go to a command prompt, browse to the MATLAB bin directory (e.g. MATLAB\R2006b\bin), and type
matlab -regserver
Quit the instance of the MATLAB software that appears and launch LabVIEW.  If this also fails, please post again with any error information you receive.

Also, the rand function in your script will not generate a Gaussian distribution. You will need to use the randn function instead.

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

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments

Edit: For some reason, I am unable to attach the VI.  I have included a picture instead.



Message Edited by GrantM on 08-08-2008 02:50 PM
0 Kudos
Message 2 of 3
(12,279 Views)
Thanks a lot for your great help! The labview 6.1 Base doesn't have the option "Analyze". The lab next to us has Labview 6i, and I copied their library containing the White Noise.vi and now is able to use it. I tried your suggestions about Matlab and came to the point of Matlab -regserver, but it still doesn't work. I'll stay with the "stolen white noise" then.
0 Kudos
Message 3 of 3
(12,250 Views)