LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

character vector is not terminated properly

Solved!
Go to solution

In the LavVIEW, i call a MATLAB script, then, we will have MATLAB command window, in which, i define a character variable as:

TravelLight_0-1658317827247.png

However, when i press 'Enter', i got following error:

TravelLight_1-1658317857306.png

 

Does anyone experience this before? Labview 2019+ Windows 10 Enterprise + MATLAB R2022a

Thanks.

0 Kudos
Message 1 of 8
(7,019 Views)

How are you calling the MATLAB script? Is this on Windows, Mac, or Linux?

 

Does it really depend on the fact that you are calling it from within LabVIEW or do you also get the same error in MATLAB directly?

 

Make sure to know the difference between Characters and Strings. 

 

0 Kudos
Message 2 of 8
(6,992 Views)

By calling a MATLAB script, I mean in the LabVIEW i use MATLAB script, when i open the VI, a MATLAB command window will pop out, it's not in the LabVIEW but a command window, in which, i define that variable, unexpected break happens as shown in the fig. This error only happens outside LabVIEW with certain WINDOWS (I have multiple laptops with different WINDOWs but same Labview), no error if I define the variable in the MATLAB script in the LabVIEW.

 

Hope I make it clear, thanks for your time.

0 Kudos
Message 3 of 8
(6,987 Views)

Can you attach code that demonstrates the problem?

 

(You have not answered the question if you get the same error if you run MATLAB directly, i.e. no LabVIEW involved.)

 

What is the language setting of your PC and keyboard?

0 Kudos
Message 4 of 8
(6,977 Views)

when running Matlab directly or inside LabVIEW, there is no such an error, it only happens when i open a VI including a MATLAB script, then, a matlab command window will pop out, typically we don't need to type in anything in that Matlab command window, but if I do like the figs, the error happens. But the error is also laptop depended, because with some laptops, it never happens, with others, it happens. The language of my laptops is English, but you reminded me of double checking the keyboard settings.

 

I will do it tmr, it's Singapore time midnight, and I don't have that laptop at hand. Appreciate your help, will update you once I arrive in the Lab.

0 Kudos
Message 5 of 8
(6,973 Views)

The VI is quite simple, there is only a MATLAB script in it. Say, I want to define a character through MATLAB script in the labview, it will be fine. However, we know that when we open a VI, which incorporates a MATLAB script, a MATLAB command window will also pop out. When I try to define a character variable, which is long (for instance, a='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), in that command window as show in the fig below, after pressing Enter, the error happens:

TravelLight_0-1658374391459.png

My window's language and keyboard are both English (US):

TravelLight_1-1658374441204.png

Another thing worth mention is that this error doesn't happen to all my WINDOWS-based laptops.

0 Kudos
Message 6 of 8
(6,947 Views)
Solution
Accepted by topic author TravelLight

It seems you are using the very old Matlab Script-node. This interfaces to Matlab through its Automation interface, aka Active X and that hasn’t received any updates in a long time.

 

Since we had the MathScript node, an implementation of parts of the Matlab kernel in LabVIEW and the new Matlab Node. MathScript is going to be removed from LabViEW, and the new Matlab Node is the means to connect to Matlab.The very old Matlab Script node is to be considered legacy. If it works that’s great if it doesn’t it will be pretty hard to get any support for it.

 

It is not the meaning to leave the Matlab Script Node empty but to actually have the Matlab Script in there. Then it shouldn’t open a command line window but simply execute that script.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 7 of 8
(6,935 Views)

Thanks, so I either bear with it or update my LabVIEW to have the new Matlab node. I understand that typically i shouldn't leave the Matlab script in the LabVIEW empty and use the outside popping out command window, in practice, I simply leave the command window blank and use the inside Matlab script. I give this example is because it is a simpler way of expressing the problems I encountered.

0 Kudos
Message 8 of 8
(6,921 Views)