LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control Labview using Matlab

Hello all, I have a Labview VI that has some controls and indicators. I need to be able to control the LV controls and read from the LV indicators using Matlab. What is the easiest and best way to go about this?

 

-Thanks.

0 Kudos
Message 1 of 11
(2,041 Views)

Hi sriv,

 


@Sriv90 wrote:

I need to be able to control the LV controls and read from the LV indicators using Matlab.

What is the easiest and best way to go about this?


Create a DLL from your VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(2,039 Views)

Thanks GerdW

 

Ok, I am not fully sure how to create a DLL in LabVIEW. Once I create the LV DLL, how do I get Matlab to call this DLL?

 

 

0 Kudos
Message 3 of 11
(2,033 Views)

Hi Sriv,

 


@Sriv90 wrote:

I am not fully sure how to create a DLL in LabVIEW.


Use the AppBuilder…

 


@Sriv90 wrote:

Once I create the LV DLL, how do I get Matlab to call this DLL?


This is a MATLAB question and should be asked in a MATLAB forum…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(2,020 Views)

Hi Sriv,

 

To expand on this:


@GerdW wrote:

@Sriv90 wrote:

I am not fully sure how to create a DLL in LabVIEW.


Use the AppBuilder…


If you have the Application Builder installed (comes with LabVIEW Pro, perhaps Full?, also available as a module I believe), then you can right click on the "Build Specifications" option at the bottom of a (saved) Project Explorer and choose New > Shared Library (DLL).

 

You can then choose VIs to export using the "Source Files" tab. Note that there are restrictions on the types of controls and indicators that can exist on VIs that you want to export.

 

That being said, are you sure this is what you want/need to do? (This is a LabVIEW forum, so there are probably plenty of people here who might suggest it would be simpler/easier/better to stick with LabVIEW 😉 )

What do you need to do in MATLAB that you either a) can't do in LabVIEW, or b) can't do in MATLAB, with LabVIEW calling a MATLAB function/script?

You might find it easier to add the MATLAB code to your VI than the VI to your MATLAB code...

 

Alternatively (and I can't really recommend this, because I much prefer LabVIEW to MATLAB, but anyway...) is it more practical to rewrite your LabVIEW code directly in MATLAB?

If you tell us what you're trying to do, we might be able to give better alternatives. 


GCentral
0 Kudos
Message 5 of 11
(1,975 Views)

Hello cbutcher,


Thanks for your input, I would prefer using LabVIEW for all the work here myself but another group that I am working with will not budge and prefers to use MATLAB for all their communication links. No one in their group knows how to use LabVIEW. I know more about LabVIEW than they do but I am no expert, but I can make my way around it.


They are using a PXI chassis with a NI PXI 6541 Digital IO card and they are not able to communicate with this card via MATLAB and asked that I assist them in creating a DLL for them.

 

They want to be able to write and read from all the 32 channels from the NI 6541 card using MATLAB to send commands to my DLL (once I create one) to then have my DLL to handshake between the PXI 6541 card and MATLAB. I am trying to make that happen for them.

 

-Thanks

0 Kudos
Message 6 of 11
(1,961 Views)
0 Kudos
Message 7 of 11
(1,948 Views)

Hello BertMahan,

 

Yes I have seen that. Our MATLAB group also showed me this and told me that the NI 6541 card is not listed as a Supported hardware and that's why they came to me to be able to control the NI 6541 card via a DLL. They also have other NI PXI cards that they already have MATLAB communicating through their PXI chassis case with multiple cards. 

 

The NI PXI 6541 card that is not supported in the MATLAB supported devices is the last one they are trying to communicate with. We have plenty of MATLAB and LabVIEW folks around here but now we are trying to marry the two together using a DLL created within LabView.

0 Kudos
Message 8 of 11
(1,938 Views)

Personally I used TCP/IP approach to connect LabView with MatLab. Created TCP/IP server in LabView and MatLab is working as a TCP/IP  client. MatLab can read / write over TCP/IP easily.

0 Kudos
Message 9 of 11
(1,881 Views)

Ok, thanks everyone for your input. Peter 111 is there a way you can elaborate on the TCP/IP idea? I have worked with TCP/IP before but if you have a picture setup or something that may help me a little more.

 

Again, I do appreciate all of the help. I am collecting any information I can to figure this out.

0 Kudos
Message 10 of 11
(1,864 Views)