LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab script node end operator error: 1050

Dear LabVIEW Community,

 

I am writing an LabVIEW application were it would be very helpfull to include a Matlab script file. The script file has been modified, so it would just have to be called by LabVIEW and executed. I am using Matlab 7.1 and the script is working fine in there. The script file can be executed separately since I am not putting any variables in or reading out. 

I am using LabVIEW 9 and I am working on a PC with Windows 8.

 

The Problem I am having with this is:

 

When I run the VI with the script node, the Matlab Command Window is called and opened but when i first run the VI an error occures that reads roughly:

Error 1050: The end operator must be used within an array index expression. 

 


This seams plain enough, the problem is I am using "end" as a terminator for "for" and "while" loops and for indexing the last item in an array. When I remove the "end"s used for terminating loops an error occures which states that at least one end is missing. 

When I exchange all the "end" operators used for indexing with some arbitrary variable which is never declared, the script starts executing but then stops at the line with the first arbitrary variable and of course an error occurs saying that there is an undesignated variable. This only works if I change all the "end"s used for indexing. 

Now here is the curious thing: If I now, after changing all the indexing "end"s to some unused variable, change all of them simply back to "end" like the original script used to be, it works!

 

So apparently the script also works via Matlab script node but I would have to "trick" the program every time I open the VI by deleting all the indexing end operators, run it and then fill in the operators again. Not very practicable. 

 

I hope my problem was explained sufficiently and somebody can help me by having solved a similar problem or explaing a way around it. 

If further information is needed I will try to provide it. 

 

I will append the Matlab script, the script node VI and a .mat file to run the script. I hope this helps solving the problem.

 

 

Thanks in advance!

 

Max Lichtenegger

 

0 Kudos
Message 1 of 2
(3,695 Views)

hi,

 

I found some KB that explain the cause of the error 1050, I hope it helps:

 

LabVIEW 6.x and Earlier Does Not Interface Properly with The MathWorks, Inc. MATLAB® Software Version 6.1 or 6.5

http://digital.ni.com/public.nsf/websearch/CE309627064A3D5686256A9C005B0A5F?OpenDocument

 

Error 1050 Occurred in MATLAB® Script Node: Complex Values Cannot be Converted to Chars

http://forums.ni.com/t5/forums/replypage/board-id/170/message-id/726355

Kais Mekacher
Applications Engineer
Germany - Munich
0 Kudos
Message 2 of 2
(3,671 Views)