找回密码
 注册
Simdroid-非首页
查看: 91|回复: 1

把MATLAB的表达式转换成符号,即时发送到公式编辑器

[复制链接]
发表于 2013-2-11 14:06:21 | 显示全部楼层 |阅读模式 来自 安徽合肥
本帖最后由 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

查看全部评分

发表于 2013-2-15 23:04:07 来自手机 | 显示全部楼层 来自 湖北武汉
Simdroid开发平台
mathtype 格式的?如果是equation格式的就好了。office2007好像不支持mathtype。

点评

mathtype6.5之后肯定是支持2007版的,已经用了很多年了,内置在office内的公式插件十分方便。  发表于 2013-2-15 23:50
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-9-30 12:35 , Processed in 0.036651 second(s), 16 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表