From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does my Matlab Script Node not execute in LabVIEW?

I am having problems with my Matlab Script Node not executing.  The script inside the node executes flawlessly when run in Matlab (takes about 10 seconds).  It writes an array to a user-defined Excel file (which I chose to be placed on the desktop).

 

When I run the VI, everything in LabVIEW seems to be properly executing.   For some reason, it seems like the Matlab Script node is ignored.  I have browsed other threads in this forum and verified the following:

- Matlab installed and has been opened previously.

- Shipping examples Lorenz Diff Eq.vi and Factal.vi both execute properly.

 

Any thoughts, feedback, or comments?

0 Kudos
Message 1 of 11
(4,329 Views)
For me it worked just fine (after I changed the path), but it didn't take 10 seconds. It only took a few seconds (after I removed the Wait function). Are you getting an error?
0 Kudos
Message 2 of 11
(4,303 Views)

I am not getting an error.  I however have noticed that on a similar VI that was working on my computer did not execute on another computer.  Additionally, this VI was working yesterday and today is not.  I do not know what could be causing the 'inconsistent' behavior.

 

 

0 Kudos
Message 3 of 11
(4,293 Views)
When you conduct your tests, are you always opening MATLAB before opening LabVIEW?
Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 4 of 11
(4,243 Views)

Hey Mark,

 

I've just tried it with LabVIEW 2009 and MATLAB r2007b and the program ran fine for me. 

What versions of MATLAB, LabVIEW and MS Office do you have?

Andy Chang
National Instruments
LabVIEW Control Design and Simulation
0 Kudos
Message 5 of 11
(4,217 Views)

Mark,

 

There are two main reasons this problem will occur.

 

1. MATLAB is not very compatible with Excel 2007, and you have Excel 2007 installed,and  no excel 2003 tools on your computer

 

2.Most likely problem: if you are using LabVIEW 2009, and you did not install the patch, MATLAB might not work properly as a script node.

 

It worked fine for me on LabVIEW 2009, and MATLAB 2008b.

 

Initially, my MATLAB script node was not working properly when I installed LabVIEW 2009. I have to reinstall both, making sure to include the LabVIEW patch.

 

If you regularly use MATLAB script node in LabVIEW, like I do, I will suggest uninstall both, reinstall LabVIEW first with the patch, then install MATLAB.

0 Kudos
Message 6 of 11
(4,190 Views)
I am using MATLAB r2006b, LabVIEW 8.6, and Excel 2003 SP3.
0 Kudos
Message 7 of 11
(4,159 Views)

What operating system are you using? if it is Vista - then that is your problem right there- VISTA.

 

If you use XP, the only advise is to reinstall both software, (assuming you use MATLAB as a script node inside LabVIEW a lot).

Otherwise, use the write to spreadsheet file in LabVIEW, and ignore the MATLAB script node completely.

 

If you use VISTA, make sure in the properties of each shortcut(LabVIEW, MATLAB),run as administrator is checked. Frankly, if you use VISTA, reinstalling may be your only solution(if you are bent on always using MATLAB inside LabVIEW) and make sure you install as admin.

 

Another problem sometimes about MATLAB script node is the accuracy of your syntax. I will suggest you have a file on your desktop(word, excel or anyfile), right click, under properties, highlight the filepath, copy, and paste in the MATLAB, then type \test.xls. to complete the full file path. sounds basic, but from experience your mistyping may cause you hours of pain.

 

Also, in your last statement on the MATLAB script node; use proper syntax and try saving in your default MATLAB path.

 

xlswrite('mytestdata.xls', C)  % where C is your data,and make sure the quotation inside the xlswrite is included.

 

Normally, if you save into your default MATLAB path, you do not need to specify the pathname.

 

One last thing, in your data A = 2, B = 3, C = A+ B, try and put A = 2.0, B = 3.0. The reason for this is that MATLAB by default takes all numbers as a double. Hence, for some reason, your computer might be sending an integer to the MATLAB workspace, this is especially common when working with image processing, and it will generate error.

 

I do not have access to LabVIEW write now, ao I am not looking at your code as I reply to you: so I might have mistyped something, but all I have written are suggestions, because I use MATLAB and LabVIEW a lot, and I have experienced some of this problem in the past.

 

 

 

0 Kudos
Message 8 of 11
(4,146 Views)

Can any body help me....

I have some bearing data files in .m format. Now my program is in Lab veiw and i want to read these data files in lab veiw

how can i do this?

 

0 Kudos
Message 9 of 11
(3,372 Views)

@arsi986 wrote:

Can any body help me....

I have some bearing data files in .m format. Now my program is in Lab veiw and i want to read these data files in lab veiw

how can i do this?

 


Please do not double post. http://forums.ni.com/t5/LabVIEW/reading-matlab-m-file/m-p/2131440#M690755

0 Kudos
Message 10 of 11
(3,369 Views)