LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW and MATLAB

Hello
I am intersted in being able to "call" a certain MATLAB function (lets call it calculate_touch_point.m- the function returns one parameter - touch_point) and I am wondering how the whole interface between LabVIEW and MATLAB works.
If anyone can answer me shortly or has any documentation such as web links or pdf files regarding ti that issue that he can tell me about will help me a lot.
Thanks, Lavi 
0 Kudos
Message 1 of 14
(3,443 Views)
Whenever questions like this pop up, my first thought is: "Have you read the documentation available with LabVIEW?". If not, please do that first, and if something is not clear, then come back to the forum and ask a more specific question. NI folks spent a lot of time writing that documentation, and it actually answers a lot of questions.

Since I'm here, I'll answer the question: Use the Matlab Script Node (not available in the Base Package). You just enter Matlab commands right in the script node. You right-click on the border to add input/output nodes that map directly to variable you define in the script. If all you're doing is calling a Matlab function that's in an .m file you just need the command to call that script, which I believe is "call my_function". You will probably need to precede it with the command to set the working directory. Again, that's a Matlab command.
Message 2 of 14
(3,427 Views)

Thank you very much !!!

The reason I am intersted in working with the MATLAB function is that I have it already finished so it saves me time, I am well aware of the

capabilities that LabVIEW offers but still I wanted to save time.

Anyway, thanks for your help

Lavi

0 Kudos
Message 3 of 14
(3,411 Views)

Hello again

I am having a problem with sending the variables from LabVIEW to the script node.

I am getting an error:

Error 1047 occurred at LabVIEW:  LabVIEW failed to send variable to the script server. Server:"" in Working with MATLAB - sending variable 18 04.vi

Do you know what am I doing wrong???

Lavi

 

0 Kudos
Message 4 of 14
(3,394 Views)
You will need to specify what version of LabVIEW you're running, and which version of Matlab you have installed. Earlier versions of LabVIEW and Matlab had problems communicating, so it's important to know what versions you're using. Does the "Lorenze Diff Eq.vi" example that ships with LabVIEW work?

Also, can you post the VI?
Message 5 of 14
(3,385 Views)

The version I am using is 8.0

Thanks

Lavi

 

0 Kudos
Message 6 of 14
(3,382 Views)
Remove the "clear all" command from the script and it should work. This command doesn't work properly with the Matlab Script Node.

Message Edited by smercurio_fc on 04-18-2007 01:53 PM

Message 7 of 14
(3,378 Views)
Hello again
 
I removed : clear all; and also removed clc; and close all; just in case, but it still doesn't work.
 
by the way - The MATLAB version I am using is R2006a, and the LabVIEW version I am using is 8.0)
 
Do you have any other suggestions?
 
Thanks, Lavi
0 Kudos
Message 8 of 14
(3,359 Views)
Hi
You have just said that it still doesn't work... Does it give to you an error message again? I have tried the VI that you have attached but it seems to work... No errors were displayed...
I use LV 8.2. Let me know what's going wrong with your VI.

Kind regards
I love the smell of napalm in the morning
Message 9 of 14
(3,342 Views)
Hi Lavi,
 
I had that same error last year - it was something to do with some drivers or something not being present. I managed to find a download somewhere on either the forums or the main NI site which fixed the problem but I can't remember where. I'll try and dig out some old stuff and see if I can find the file.
 
In the meantime, search both the forums and the main NI site for Error 1047 - I'm pretty sure thats how I found it in the first place
 
Ian
0 Kudos
Message 10 of 14
(3,343 Views)