LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

matlab script not running!!


Hi attached is my vi for simulation of some data....I've a matlab script written in my block diagram but it's not running at all!!!Smiley Surprised
and the matlab prompt does not pop up!
I'm also writing my dispnew function of matlab. This function works perfect when run in the command window of matlab.
looking for help
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dispnew(C,x,y,fignumber,xlabeltext,ylabeltext,text)
colormap(jet(256))
   
      imagesc(x,y,C)
    
      axis('xy')
      ylabel(ylabeltext)
      xlabel(xlabeltext)
      %colorbar;
      title(text)
      drawnow

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0 Kudos
Message 1 of 4
(3,758 Views)
0 Kudos
Message 2 of 4
(3,757 Views)

Roiht,

To be clear, Matlab and MathScript are not the same.  MathScript understands the syntax of .m files, the same way multiple IDEs can understand .c files.  However, this does not mean that all the functions of Matlab are the same in MathScript.  There is a list of all of the LabVIEW MathScript functions here:

LabVIEW MathScript Function List

You will want to check and see if the functions you are using are available in MathScript.  If not, there may be a similar function that you can use.  I would also suggest taking a look at the Starting Points and Resources for Learning LabVIEW MathScript document.  It has a lot of good information about using MathScript in LabVIEW.  I hope this helps.

Brian Coalson

Software Engineer
National Instruments
0 Kudos
Message 3 of 4
(3,728 Views)

roiht,

Since it looks like you are only using a MATLAB Script Node, I'll assume that you aren't using MathScript as mentioned in Brian's post, but please correct me if I'm wrong.  When you run this VI does it produce any error messages, or does it just run without the script node producing any plots?  If you are getting an error, then there may be a problem with the path that would prevent the dispnew function from being called.  This can be addressed by using addpath in your script node.  It also looks like the values of "f1" and "M" aren't being set anywhere here.

I'm not sure whether you have been able to run any other MATLAB Script Nodes.  This would help us figure out if there is a problem with this specific script or with the functionality of the script node in general.  Try running a very simple MATLAB Script Node from a new VI to see if it works properly.

Also, which versions of LabVIEW and MATLAB are you using?

Chris M
LabVIEW R&D

0 Kudos
Message 4 of 4
(3,720 Views)