08-28-2020 08:58 AM
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.
08-28-2020 09:01 AM
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…
08-28-2020 09:06 AM
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?
08-28-2020 09:17 AM
08-28-2020 12:25 PM
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.
08-28-2020 02:24 PM
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
08-28-2020 03:37 PM
08-28-2020 04:50 PM
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.
08-30-2020 12:43 AM
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.
08-31-2020 07:41 AM
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.