- 积分
- 0
- 注册时间
- 2011-11-14
- 仿真币
-
- 最后登录
- 1970-1-1
|
本帖最后由 zhashihong 于 2013-2-11 14:17 编辑
% 把MATLAB的表达式转换成符号,即时发送到公式编辑器
function MathType
% MathType
% interaction with the internal MathType engine (requires maple 16 or later)
% to send complex math equation and Matrix to MatyType
% Date : 2013/02/11
%
% Author : shihong zha
% Email : shzha@iim.ac.cn
% Released date : 2013/02/11
% related file :maplePrompt.m
% Author : Damith Senaratne, (http://www.damiths.info)
% % % % % % % % % % % % % % % %
% example
% f=sym('alpha',3)
% % f =
% %
% % [alpha1_1 alpha1_2 alpha1_3]
% % [ ]
% % [alpha2_1 alpha2_2 alpha2_3]
% % [ ]
% % [alpha3_1 alpha3_2 alpha3_3]
% f2=f.*f
% % f2 =
% %
% % [ 2 2 2]
% % [alpha1_1 alpha1_2 alpha1_3 ]
% % [ ]
% % [ 2 2 2]
% % [alpha2_1 alpha2_2 alpha2_3 ]
% % [ ]
% % [ 2 2 2]
% % [alpha3_1 alpha3_2 alpha3_3 ]
% MathType
% % MathType >> f
% % MathType >> f2
% % % % % % % % % % % % % % % %
display('============================================================');
display('''MathType'' additional commands:');
display('- clc : clear screen');
display('============================================================');
h = actxserver('WScript.Shell');
%Assume only one MathType
if h.AppActivate('MathType')==0
h.Run('MathType'); %Invokes MathType.exe
end
while(true)
cmd = input('MathType >> ','s');
if strcmp(cmd,'exit')
display('bye, bye!');
break;
elseif strcmp(cmd,'esc')
display('bye, bye!');
h.AppActivate('MathType')
h.SendKeys('^{F4}'); %Sends keystrokes
h.delete
break;
elseif strcmp(cmd,'clc')
clc;
elseif strcmp(cmd,'who')
evalin('base','who');
else
cmd2=sym(evalin('base', (cmd)))% change matlab cmd into sym
g=maple('MathML[Export]',[cmd,'=',char(cmd2)])
g=char(g)
g=g(2:end-1)
clipboard('copy', g) %copy g to clipboard
h.AppActivate('MathType')
pause(.1); %Waits for the application to load.
h.SendKeys('^{v}'); %paste clipboard to MathType
h.SendKeys('{enter}'); %newline
end
end
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
评分
-
1
查看全部评分
-
|