07-20-2022 06:52 AM - edited 07-20-2022 06:53 AM
In the LavVIEW, i call a MATLAB script, then, we will have MATLAB command window, in which, i define a character variable as:
However, when i press 'Enter', i got following error:
Does anyone experience this before? Labview 2019+ Windows 10 Enterprise + MATLAB R2022a
Thanks.
Solved! Go to Solution.
07-20-2022 10:25 AM - edited 07-20-2022 10:26 AM
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.
07-20-2022 10:31 AM - edited 07-20-2022 10:37 AM
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.
07-20-2022 10:38 AM
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?
07-20-2022 10:47 AM
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.
07-20-2022 10:35 PM - edited 07-20-2022 10:37 PM
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:
My window's language and keyboard are both English (US):
Another thing worth mention is that this error doesn't happen to all my WINDOWS-based laptops.
07-21-2022 03:52 AM - edited 07-21-2022 03:57 AM
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.
07-21-2022 04:41 AM
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.