cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

MathCad on R

ajarvis-2
1-Visitor

MathCad on R

Hi,

I am using R to analyze some thermal conductivity data, and I also have some related functions in MathCad 15. Does anyone know of a way to access or import MathCad into R?

I know it is possible to do it with MatLab: there is a package written in R for it.

I believe that many R users use C++ to write the functions that I have in MathCad: and it's easy to import C++ into R. But I don't know C++.

I have a lot of code in R, and it does what I need in general, so I want to use it as my main package for this application. I'm just hoping to find a way to re-use what i've done in MathCad.

I asked the same question on StackExchange and so far nobody has come back and said it's possible.

I suspect that it's not possible, and that i will have to re-type/formulate my MathCad code into C++ for use in R.

Thanks,

Alan

ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:ajarvis-2)

By worksheet, I mean a Mathcad worksheet. You can pass values from R to a Mathcad worksheet via the automation interface, have Mathcad do it's calculations, and then get the results via the automation interface. At least, I assume you can. I'm not familiar with R, but it's hard to imagine it does not have a way to call other software.

View solution in original post

6 REPLIES 6
RichardJ
19-Tanzanite
(To:ajarvis-2)

You can call Mathcad via the automation interface. That allows you to pass values to a worksheet, and get calculated values form a worksheet.

Sorry, but I don't understand. When you say "worksheet" do you mean an Excel worksheet? I'm not using Excel, but R. Was that understood?

I need to be able to use the given functions (now written in MathCad) inside R.

Pass data to and from them to databases.

I know one can do this for MATLAB, see for example:

http://cran.r-project.org/web/packages/R.matlab/index.html

http://mathesaurus.sourceforge.net/octave-r.html

But I don't see anything for MathCad.

I wondered if maybe I just didn't know either language well enough, but I'm becoming pretty sure that it's not possible.

If so, I guess I just need to learn enough C++ (or MatLab) to be able to do what I need.

RichardJ
19-Tanzanite
(To:ajarvis-2)

By worksheet, I mean a Mathcad worksheet. You can pass values from R to a Mathcad worksheet via the automation interface, have Mathcad do it's calculations, and then get the results via the automation interface. At least, I assume you can. I'm not familiar with R, but it's hard to imagine it does not have a way to call other software.

Aha! OK, thanks very much. I shall try that.

And if you don't mind, a related question is that I'm a beginner with both languages.

Do you think it's better to get the integration withR and MathCad via the automation interface, or just bit the bullet and learn enough to do it with the Rcpp/C++ route?

I mean does the automation interface work really smoothly? Reasonably easy to learn etc.

I've read comments that although there is a link between R and Matlab that it can be finicky. And that the best option if you have anything very complex is to just do it all in MatLab or in R.

I have some code in both R and MathCad from a guy who's helping me that I can use as templates.

RichardJ
19-Tanzanite
(To:ajarvis-2)

Do you think it's better to get the integration withR and MathCad via the automation interface, or just bit the bullet and learn enough to do it with the Rcpp/C++ route?

I don't know what's in the Mathcad worksheet(s), and I'm not familiar with R. So there's no way for me to make that call.

I mean does the automation interface work really smoothly? Reasonably easy to learn etc.

The documentation is not very comprehensive (see Help, Developers reference). If you are familiar with programming and calling external objects etc it's good enough, but if you have never done anything like this before you might have something of an uphill battle.

OK that's very helpful.

I think I'll put more effort into figuring out how to do what i need in R/C++ then for this application.

I'm not so familiar with external objects and I'm really rusty with programming.

Thanks very much for your feedback: you've saved me time.

Announcements

Top Tags