LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling MathCAD from LabVIEW

I tried to search for this to see if has been answered before. But I did not find anything.

 

Anyhow, I am using LabVIEW to open MathCAD, run a prebuilt worksheet, then close the worksheet. This runs in a loop.

 

My issue is that one of my worksheets requires the use of MathCAD 13, while another requires the use of MathCAD 15. I use the attached VI to open MathCAD. My problem is that this code always opens the most recent version of MathCAD that was installed.

 

Does anyone know how I can have both versions installed on my machine and control which version gets opened?

 

Thanks,

Joe

 

0 Kudos
Message 1 of 4
(3,083 Views)

Hey Joseph,

 

I don't have MathCAD installed on my system, so I can't see all the properties you can select, but there may be some options you could try.

 

From the actual property node, where you make MathCAD visible, right click "visible" and got to "select property" (or just left click visible and you'll be taken to the property list directly). Try to find a property that says "StartupPath" or "Path" or "Version". One of these options should have the capability to write to it. So right click on the property node and select "change all to write" if it's not already. Most likely it will be "StartupPath". Wire a string constant to the "StartupPath" that is the path to the version of MathCAD that you want to use (ie - C:\Program Files\MathCAD\MathCAD 15.exe) 

 

Another option would be to right click the application reference and go to  Select ActiveX Class>Browse. Then, see if there are separate options for MathCAD 13 and MathCAD 15. So if you have other options besides Mathcad.IMathcadApplication, such as Mathcad13.IMathcadApplication then you could select that reference.

 

You could also just use the System Exec.vi and send the command 'START MathCAD 15.exe' or 'START MathCAD 13.exe' to the command prompt. 

 

As a follow up question, is there some functionality that MathCAD 13 had that MathCAD 15 doesn't? Why can't you run both worksheets in MathCAD 15? Is there a way to load the worksheet made in MathCAD 13 into MathCAD 15 and save it as a MathCAD 15 worksheet? 

 

Hope this helps!

 

-Nathan H

Software Developer
National Instruments
0 Kudos
Message 2 of 4
(3,056 Views)

Nathan,

 

Thank you for your response. It seems there is no property called "StartupPath" and the properties for Path and Version are read only.

 

I am currently looking into the possibility of separate options for the application reference. I made a quick look at this and nothing appears obvious. But I haven't given up on that just yet. If I don't make progress on that front soon, I will try your suggestion to use the systemExec VI. I had not thought of that one. Thank you for that. I have high hopes for that one. I have manually started each version of MC and then run my sample VI to open MC and that seems to work.

 

To answer your question, I am not sure what the difference between the two versions is. I did not write teh worksheets I am using. I inherited them. However, The funtion of both worksheets is to develop the coefficients for a complex digital filter that is used to synthesize a complex impedance. One is used for standard telephony sample rate and the other is used for wideband telephony.

 

For reasons that are not completely clear to me, the wideband worksheet requires MC 14 or 15. It does not work with 13. I believe it has to do with the optimization routines used in MC13.

 

However, for other reasons which are also not clear to me (or to the author of the worksheets for that matter) the older, narrow band, worksheets produce unstable results when run in MC14 or 15. Yet they work fine in MC13.

 

I was hoping the author of the worksheets could have fixed this version issue. But he has moved on to other projects and it is difficult for him to switch back to working on this. I can improve teh situation immensely if I can get my LV code to call whichever version of MC I need.

 

BTW, The main purpose of the LV code to call the MC worksheet is that it can take anywhere from 10 minutes to over an hour for the worksheet to generate just one set of coefficients. I have more than 1000 sets to generate. So, it is necessary to automate this generation process.

 

Thanks again for your help. I will post back here with my results when I have them.

 

Joe

0 Kudos
Message 3 of 4
(3,031 Views)

Nathan,

I looked at this a little more closely. I cannot seem to find any ActiveX class that works. So, I tried your last suggestion of using the systemExec VI.

 

It seems to work but is a little worrysome. If I set "Wait until complete" to TRUE, then it hangs in that VI until I manually close MathCAD. If I set the input to FALSE, I need to have some sort of open loop delay between that VI and the one I used to use to open MathCAD. Otherwise, I end up with both of them open.

 

I need to still run the open application VI so I can get references to the application to run and open the correct worksheets.

 

I find that if I use a delay betwwen the SystemExec VI and the open application VI, things seem to be working. I just find it worrysome to not be able to close the loop and programmatically determine when the application is up and running. But I think I can make this work.

 

Thanks for your help.

 

Joe

0 Kudos
Message 4 of 4
(3,027 Views)