Using Matlab to drive Mathcad

12 ビュー (過去 30 日間)
Gregory
Gregory 2013 年 8 月 1 日
編集済み: John BG 2017 年 3 月 8 日
I am trying to use Matlab to open a Mathcad sheet, pass data and save versions of the sheet with the inserted data.
So far I can open the Mathcad sheet, insert values but cannot alter definitions (when I save the sheet the values revert to their original uncalculated state - which is what they should do).
Does anyone know the code to set definitions in Mathcad via Matlab?
Any help would be much appreciated.
h = actxserver('Mathcad.Application')
h.visible=1 % make the application visible!
h.methods % these are the methods that are available at this level
h.invoke % these are the actions that can be invoked at this level
inspect(h) % more investigation of the application inteface
h.worksheet.invoke % One level down in the interface - the worksheet level
sht = h.worksheet.Open('C:\Users\gregory.kemble\Documents\MATLAB\test_mcad_sheet.mcd') % open our MathCAD worksheet
sht.SetValue('in0',7)
sht.SetValue('in1',6)
sht.SetValue('var1',5)
sht.Save
fullname = 'C:\Users\gregory.kemble\Documents\MATLAB\new5.mcd' %sht.FullName
%new_sht = sht
sht.SaveAs(fullname)
sht.Close
h.Quit % this causes the MathCAD application attached to handle 'h' to quit
h.delete
  2 件のコメント
Thomas
Thomas 2017 年 3 月 8 日
Hello, Could you provide the mathcad file ?
Thanks
John BG
John BG 2017 年 3 月 8 日
編集済み: John BG 2017 年 3 月 8 日
would it make sense to consider focusing on MATLAB?
if not, it's probably because Mathcad has something that MATLAB doesn't?
what would it be, the 'hc' instead of 'L'?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeFunctions についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by