資源簡介
使用matlab mobile等與matlab 2011a及以上連接的工具。
使用時(shí)解壓該文件,執(zhí)行matlab的cd命令到解壓文件夾,運(yùn)行install_connector來安裝,執(zhí)行connector on,第一次使用輸入5個(gè)字符以上的連接密碼即可。

代碼片段和文件信息
function?install_connector()
%INSTALL_CONNECTOR??Install?the?MATLAB?Connector.
%???INSTALL_CONNECTOR?Install?the?files?for?the?MATLAB?Connector?into?your?MATLAB?installation.
%???Copyright?2010-2011?The?MathWorks?Inc.
%?turn?off?connector?if?running
try
????com.mathworks.util.ClassLoaderBridge.findClass(‘com.mathworks.matlabserver.embeddedwebserver.JettyWebServer‘);
????running?=?com.mathworks.matlabserver.embeddedwebserver.JettyWebServer.isRunning();
????if?running
????????connector(‘off‘);
????????clear(‘java‘);
????end
catch?e?%#ok
end
%?Determine?location?of?this?file
currentFile?=?mfilename(‘fullpath‘);
[currentDir?currentscriptName]?=?fileparts(currentFile);
%?Define?variables?used?in?the?script
productName?=?‘MATLAB?Connector‘;
licenseAgreementFile?=?fullfile(currentDir?‘MATLAB_Connector_SLA.txt‘);
zip_file?=?‘MATLABconnector.zip‘;
toolboxStr?=?‘toolbox‘;
connectorStr?=?‘connector‘;
connectorRoot?=?fullfile(matlabroot?toolboxStr?connectorStr);
connectorHelpFile?=?fullfile(connectorRoot?connectorStr?‘html‘?‘bsjg133.html‘);
helpFileStr?=?strcat(‘file:///‘?connectorHelpFile);
%?make?sure?user?is?using?at?least?MATLAB?R2009b
if?verLessThan(‘matlab‘?‘7.9‘)
???error(‘%s?does?not?run?on?MATLAB?versions?earlier?than?R2009b.‘?productName);
end
%?check?if?the?jvm?is?available
if?(~usejava(‘jvm‘))
????error(‘%s?requires?Java?to?run.‘?currentscriptName)
end
%?check?if?archive?exists
if?(exist(zip_file?‘file‘)?~=?2)
????error(‘Archive?%s?does?not?exist.\nInstallation?failed.‘?zip_file)
end
%?Display?License?Agreement
if?(exist(licenseAgreementFile?‘file‘)?~=?2)
????error(‘The?%s?license?agreement?file?does?not?exist?on?your?machine.\nThis?is?an?invalid?installation.‘?productName)
end
type(licenseAgreementFile)
reply?=?input(‘Do?you?accept?this?license?agreement??Y/N?[N]:?‘?‘s‘);
msg?=?sprintf(‘You?must?accept?the?license?agreement?if?you?wish?to?continue?installing.?\n...Exiting?the?%s?Installation.‘?productName);
if(isempty(regexpi(reply‘^(y|yes)$‘)))
????disp(msg)
????return
end
doinstall
install_connector_path_update(false);
rehash?toolboxcache
%?Wrap-up
msg?=?sprintf(‘\nInstallation?of?%s?is?complete.\n‘?productName);
disp(msg)
msg?=?sprintf(‘To?start?the?connector?type?\“connector?on\“.‘);
disp(msg)
msg?=?sprintf(‘\nFor?more?information?see?the?Setup?and?User‘‘s?Guide.‘?helpFileStr);
disp(msg)
end
function?doinstall
productName?=?‘MATLAB?Connector‘;
%?check?if?the?user?can?write?to?matlabroot
tempFileInMLRoot?=?tempname(matlabroot);
fid?=?fopen(tempFileInMLRoot?‘w‘);
if?(fid?==?-1)
????failed?=?true;
????
????if?ispc
????????try
????????????proc?=?System.Diagnostics.Process;
????????????%?EXE?to?run
????????????proc.StartInfo.FileName?=?fullfile(matlabroot‘bin‘‘matlab‘);
????????????%?Arguments?to?the?EXE
????????????proc.StartInfo.Arguments?=?‘/wait?/noslpash?/nodesktop?/r?install_connector_helperexit‘;
????????????%?Run-as?admin
????????????proc.Star
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????4370919??2011-01-28?10:29??MATLABconnector.zip
?????文件????????1030??2011-01-28?10:27??install_connector_path_update.m
?????文件????????4001??2011-01-28?10:27??install_connector.m
?????文件????????1129??2011-01-28?10:27??install_connector_helper.m
?????文件????????7741??2011-01-28?10:27??MATLAB_Connector_SLA.txt
評(píng)論
共有 條評(píng)論