12-04-2023 02:14 AM
I am working with LabVIEW 2023 and MATLAB 2023. I want to convert MATLAB code and its associated functions to LabVIEW without using MathScript. When I use MathScript, I obtain the results figures and windows as if I were using MATLAB. I desire to display and visualize the results using LabVIEW's graphical elements rather than MATLAB's.
How can I convert Matlab code with its related functions to Labview ?
Thanks
Best Regards.
12-04-2023 02:34 AM
Hi HUSAM,
@HUSAM2324 wrote:
How can I convert Matlab code with its related functions to Labview ?
By recreating the code in LabVIEW…
12-04-2023 02:55 AM
Thank you for replying @GerdW
how can I do that ? May you give me the instructions ?
12-04-2023 02:58 AM - edited 12-04-2023 03:00 AM
Hi Husam,
@HUSAM2324 wrote:
how can I do that ? May you give me the instructions ?
Analyze the MATLAB code and recreate its functionalities using LabVIEW functions.
Which (other) kind of instruction do you need/expect?
Simple example:
12-04-2023 03:16 AM
Hi GerdW
From your explanation, I gather that I need to recreate the system coded in MATLAB within LabVIEW, the code is long and implementing it in LabVIEW will be a bit difficult. Is there any tool available to directly convert the code to the LabVIEW environment? If not, how can I display the results using LabVIEW's graphical elements when using MathScript?
12-04-2023 03:29 AM
Hi Husam,
@HUSAM2324 wrote:
From your explanation, I gather that I need to recreate the system coded in MATLAB within LabVIEW, the code is long and implementing it in LabVIEW will be a bit difficult. Is there any tool available to directly convert the code to the LabVIEW environment?
AFAIK there is no tool to create LabVIEW code from a MATLAB source.
(You might create a DLL from your MATLAB code and call that DLL. I don't know if that will result in less work…)
@HUSAM2324 wrote:
If not, how can I display the results using LabVIEW's graphical elements when using MathScript?
Delete the plotting commands in MathScript and wire the data to LabVIEW indicators, like XYGraph or WaveformGraph…
12-04-2023 08:01 AM
See Integrating Compiled MATLAB Functions with LabVIEW with a .NET Assembly Approach or Using DLLs Built with MATLAB Coder in LabVIEW
12-04-2023 08:38 PM
@HUSAM2324 wrote:
Hi GerdW
From your explanation, I gather that I need to recreate the system coded in MATLAB within LabVIEW, the code is long and implementing it in LabVIEW will be a bit difficult.
A number of the responses to your original question are seasoned LabVIEW Developers -- several are even LabVIEW Champions! Why don't you post your Matlab code (you can just attach the .m file, assuming it involved with a GUI, but is straight Matlab code) and let us get a better idea of what might (or might not) be practical?
Bob Schor
12-05-2023 01:58 AM
Thank you GerdW
ZYOng
and Bob_Schor for your assistance.
My objective is to execute this MATLAB code along with its functions on a USRP 2943R device, utilizing LabVIEW in the process. Initially, I assumed that converting the MATLAB code to LabVIEW would be necessary, followed by adjustments for compatibility with the USRP device. However, I'm unsure if this approach is accurate. Please provide any suggestions or guidance.
The MATLAB code I wanted to convert to LabVIEW is attached below.
12-05-2023 07:56 AM - edited 12-05-2023 08:15 AM
Hi Husam,
@HUSAM2324 wrote:
My objective is to execute this MATLAB code along with its functions on a USRP 2943R device, utilizing LabVIEW in the process. Initially, I assumed that converting the MATLAB code to LabVIEW would be necessary, followed by adjustments for compatibility with the USRP device. However, I'm unsure if this approach is accurate.
You can use MathScript to execute your MATLAB code. Or you can translate all that code into LabVIEW VIs. (And some other options were mentioned too.)
So which way do you want to take?
Edit: I started a simpler m-file:
(I'm not a MATLAB expert, so please cross-check my approach.)
@HUSAM2324 wrote:
The MATLAB code I wanted to convert to LabVIEW is attached below.
Generic advice: please don't use proprietary software to create archives.
Any computer can handle ZIP nowadays, for RAR you need some special software!