LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dll, matlab an LadVIEW

Problem is still there!
OK,

I installed the runtime engine, or MCR,  the Path under the System variables has following Matlab-related variables:


D:\Program Files\MATLAB\MATLAB Compiler Runtime\v711\runtime\win32;

D:\Program Files\MATLAB\R2010b\runtime\win32;

D:\Program Files\MATLAB\R2010b\bin;

D:\Program Files\MATLAB\MATLAB Compiler Runtime\v714\runtime\win32


Then I created the environment variables for mcrmcl.dll as User variable

D:\Program Files\MATLAB\R2010b\bin\win32


Then I restarted the computer to let it work. But still the old problem, "mcrmcl.dll is missing" I can't find similar case by google search, so it is not a common problem. Any idea?

Arnold
0 Kudos
Message 51 of 86
(2,750 Views)

So more updates:

Actually after the installation of MCR, v714, I had another copy of mclmcr.dll.

I added the 2nd path to the environment variable PATH

D:\Program Files\MATLAB\MATLAB Compiler Runtime\v714\bin\win32

Now the missing mclmcr.dll error is gone, but new error came in:

The procedure entry point ?initialize@task_scheduler_init@tbb@@QAEXHI@Z could not be located in the dynamic link library tbb.dll.

 

Any idea?

Arnold
0 Kudos
Message 52 of 86
(2,761 Views)

I gave up VS2008 + Matlab 2009Rb, moved to Matlab 2010Rb and VS2010. Now I did the same thing, added all dependent path, additional include etc. Then I still got this:

LINK : fatal error LNK1104: cannot open file 'libmyadd2.lib mclmcrrt.lib mclmcr.lib'. Cannot even pass the build now. Any suggestion?

Arnold
0 Kudos
Message 53 of 86
(2,757 Views)

Hi,

 

Out of curiousity, why aren't you using the mathscript node? I did a dll becasue my LV was old, but you should have this option.

 

Thanks,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 54 of 86
(2,751 Views)

The mathscript doesn't include the statistic toolbox, someone gave me a very complicated algorithm written in matlab. The matlab node in labview doesn't work well because it takes a lot of initiating and running the code. DLL is said to be the fastest and cleanest way. But i was stuck in this process, for those errors, any suggestions?

 

Also, if i have multiple m files, for example my fun1. m calls functions from fun2.m and fun3.m. Is there a way to combine them in a single dll?

 

Thanks.

Arnold
0 Kudos
Message 55 of 86
(2,743 Views)

Hi,

 

1. "cannot open ..." This is a folder problem again, you should include the folder these files are in in your "include directories" field.

2. creating dll with a number of files: as far as I know, if you compile fun1 it will automatically include whatever you need from fun2 and fun3, but to be on the safe side simply include it in your compile command: mcc fun1 fun2 fun3. It could be different in newer Matlab versions, you can look up mcc in the Matlab help.

 

Good luck,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
0 Kudos
Message 56 of 86
(2,737 Views)

Hi,

I finally figured out the issue that getting Matlab dll compiled in VC++ 2008, a lot of settings needed to be changed, however, there are not enough references about how to do it with new version of VC and Matlab.

 

The new problem coming out when it comes to importing the C++ compiled dll to Labview 2009. I tried to import both of my dll and your dll files dllexample.dll. Both failed. "Same error, the program can't start because mclmcrrt71.dll is mising from your computer, Try reinstalling the program to fix this problem." Any idea on how to do it?

 

I checked the matlab help, they say it is because the version of Matlab compiler is not compatible. But I am pretty sure that I installed the MCR and I have succeeded in calling the Matlab dll in Visual C++ 2008. It should not be a problem.

 

My system setup is Labview 2009.

Arnold
0 Kudos
Message 57 of 86
(2,688 Views)

Hi,

 

The problem is probably of paths. You should check your path environment variable to make sure that the folder of the Matlab component runtime is there. For this purpose:

1. Go to the "My computer" (or "computer") icon on your desktop.

2. Right click, and choose properties.

3. Go to the advanced tab.

4. Click "Environment Variables"

5. In system variables, choose "path" and click "edit".

6. Look at the path. One of the paths there (the paths are separated by semicolons) should be the path of the runtime folder. I have on my computer: "C:\\v71\runtime\win32" (with Matlab 7.1 on XP). See if you also have something similar.

If you have two versions of Matlab runtime installed, make sure that the Matlab version you are running in the dll with LabView is BEFORE the other one.

 

Good luck,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
Message 58 of 86
(2,676 Views)

Hi, I fixed it, thanks for your suggestion. Then I finally come to this "only run once issue". I took your structure that split the program into initialize, function, terminate, 3 parts. However, this allows me to call functions many times in one run. But once I end the run and start again, it will not allow me to proceed because initialize part failed. I checked out some comments from other people in this forum, it says "When you run your vi have a boolean control on the front that will have the intitialize for MATLAB called only once.  Then you can call the processing function all you want.  Do not call the terminate.  If you run again, do not recall the initialize routine.  Simply call the processing function since it is still attached to the LabVIEW process.  However, if you screw things up it really screws things up.  The best is to delete the folder that the MATLAB runtime creates, close LabVIEW and try again."

 

So my question is, I still get this problem in Labview 2009. I want to have many runs with the wrapper VI for many times, is there any trick that allow me to "call the processing function all you want.  Do not call the terminate.  If you run again, do not recall the initialize routine. "

 

Thanks

Arnold
0 Kudos
Message 59 of 86
(2,660 Views)

I read your threads, I'm still curious is there any trick we can set so as to allow the labview system smart enough to "call the processing function all you want.  Do not call the terminate.  If you run again, do not recall the initialize routine." as you said? What is the advantages that use dll over the EXE in labview? To get the parallelism working well with each other?

Arnold
0 Kudos
Message 60 of 86
(2,657 Views)