ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send a string variable to Matlab script in Labview 7.1

I had a program which contains a matlab script. It works in Labview 7.0 I figured out that in the new version labview I need to change the type of input varialbes. e.g. from real -> complex; real vector -> complex vector. But I was still unable to feed a string to the string input I created. The error message is: LabVIEW failed to send variable to the script server. Server:"??? Undefined function or variable "***".
0 Kudos
Message 1 of 5
(4,400 Views)
The Matlab Script Node only allows six datatypes and they are all numeric types. To workaround this situation, first use Matlab's 'double' command to covert the string to a numeric array. To then use the string in LabVIEW again, you'll want to use the Byte Array to String.vi to convert back into a LabVIEW string.

I've attached a simple VI to this email. Hope this helps!
Message 2 of 5
(4,400 Views)
Thanks. You answered my question. To add on that, I think users can export a string without any format change. Just add an output and define it as a string variable. It works. However, you are absolutely correct that the matlab script node only accepts numeric inputs now.

I attached the modified example here.

Thank you KileenC
0 Kudos
Message 3 of 5
(4,400 Views)
Thanks for noticing that. You're right-on. 🙂
0 Kudos
Message 4 of 5
(4,400 Views)

in Labview script data tyypes are numeric you can convert data type numeric like double for string and after  simulation convert ack into string check  code pro zone.

0 Kudos
Message 5 of 5
(2,330 Views)