资源简介
simmechanics.zip
代码片段和文件信息
function install_addon(zip_file)
%
% INSTALL_ADDON Install the specified addon to the current MATLAB installation.
% INSTALL_ADDON ZIP_FILE.ZIP Install the contents of ZIP_FILE to MATLABROOT.
% Copyright 2008-2012 The MathWorks Inc.
% first check if the jvm is available
if (~usejava(‘jvm‘))
error(‘install_addon requires Java to run.‘)
end
% check args
if (nargin ~= 1)
error(‘Usage: install_addon ‘)
end
% check if archive exists
if (exist(zip_file ‘file‘) ~= 2)
error(‘Archive %s does not exist.\nInstallation failed.‘ zip_file)
end
% obtain addon name ver and arch from zip_file name
[~ zip_file_name ~] = fileparts(zip_file);
[addon_name remain] = strtok(zip_file_name ‘.‘);
[addon_rel remain] = strtok(remain ‘.‘);
addon_arch = strtok(remain ‘.‘);
% strip off ‘r‘ prefix from addon_rel
addon_rel = strtok(addon_rel ‘r‘);
msg = sprintf(‘Installing %s...‘ addon_name);
disp(msg)
% check addon arch against matlab arch
matlab_arch = computer(‘arch‘);
if (~strcmpi(matlab_arch addon_arch))
error(‘Archive architecture (%s) does not match the MATLAB architecture (%s).\nInstallation of %s failed.‘ addon_arch matlab_arch addon_name)
end
% check addon ver against matlab ver
matlab_rel = version(‘-release‘);
if (~strcmpi(matlab_rel addon_rel))
error(‘Archive release (%s) does not match the MATLAB release (%s).\nInstallation of %s failed.‘ addon_rel matlab_rel addon_name)
end
% installing to matlabroot
install_dir = matlabroot;
% unzip zip file to install_dir
msg = sprintf(‘Extracting archive %s to %s...‘ zip_file install_dir);
disp(msg)
unzipped_files = unzip(zip_file install_dir);
% check if files were extracted from zip file
if (isempty(unzipped_files))
error(‘No files were extracted from archive %s.\n%s installation failed.‘ zip_file addon_name)
end
% fix permissions on extracted files - make files writable
for i = 1:length(unzipped_files)
file = unzipped_files{i};
fileattrib(file ‘+w‘);
end
% add directories from addon .phl file to pathdef.m current path
msg = sprintf(‘Adding directories for %s to path...‘ addon_name);
disp(msg)
% stash current path pathdef before re-creating pathdef
current_path = path;
saved_path = pathdef;
% turn off duplicate path warning before modifying path
w_state = warning(‘off‘ ‘MATLAB:dispatcher:pathWarning‘);
% recreate pathdef to get newly added .phl file into pathdef
restoredefaultpath;
path(saved_path path);
if (savepath ~= 0)
disp(‘Warning: Unable to save modified path to file.‘)
msg = sprintf(‘To have %s on the path for future MATLAB sessions you will need to save the path to a different file.‘ addon_name);
disp(msg)
end
% rebuild current path with newly added paths
path(current_path path);
% restore duplicate path warning
warning(w_state);
% Refresh docroot in case new doc directories were added
docroot(docroot);
% Make changes for doc center to work
destination = com.mathworks.install.command.doc.BuildSh
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3343 2016-04-27 14:16 install_addon.m
目录 0 2016-05-03 10:47 smli
目录 0 2014-02-28 00:26 smli
目录 0 2014-02-28 00:26 smli
文件 1339 2014-01-29 23:38 smli
目录 0 2014-02-28 00:26 smli
文件 641536 2014-01-30 11:54 smli
文件 1800704 2014-01-30 12:09 smli
文件 476672 2014-02-21 12:02 smli
文件 49664 2014-01-30 11:07 smli
文件 231936 2014-01-30 11:00 smli
文件 261120 2014-01-30 11:21 smli
文件 752128 2014-01-30 11:06 smli
目录 0 2014-02-28 00:26 smli
目录 0 2014-02-28 00:26 smli
目录 0 2014-02-28 00:26 smli
文件 85 2014-01-21 11:56 smli
文件 85 2014-01-21 11:56 smli
文件 13746 2014-01-21 11:55 smli
文件 14200 2014-01-21 11:55 smli
文件 14205 2014-01-21 11:55 smli
文件 14892 2014-01-21 11:55 smli
文件 15265 2014-01-21 11:55 smli
文件 16112 2014-01-21 11:55 smli
文件 33149 2014-01-21 11:55 smli
文件 30 2014-01-21 11:55 smli
文件 36369 2014-01-21 11:55 smli
文件 36074 2014-01-21 11:56 smli
文件 80 2014-01-21 11:56 smli
目录 0 2014-02-28 00:26 smli
文件 85 2014-01-18 07:50 smli
............此处省略498个文件信息
相关资源
- LabWindowsCVI数据采集与串口通信典型应
- VerilogHDL设计与实战目录.pdf
- CiscoAnyConnect_v4.9.dmg
- AlgorithmDesign.rar
- visio2010激活教程.rar
- [神经网络设计].(美国)Hagan.清晰版
- 双11电子书_不一样的技术创新_完整版
- 6hc-online.rar
- project2010密钥激活工具Office2010Toolkit
- 快速提升关键字排名模拟点击工具.
- 14359376Xshell_Plus_v6_Final_永久授权补全简
- LitePal.rar
- 山东大学机器学习期末复习资料.zip
- 微擎0元拼团涨粉2.0.1.zip
- 剪辑的语法_13682282.pdf
- be85su.pdf
- Imatest_3.5.1.rar
- 编译原理基础—刘坚.pdf
- VA_X_Setup2118.exe
- 最新AnyLogic多方法建模与仿真-官方培
- 安卓室内定位初窥.rar
- qq_35523524_10270722.zip
- iMGExplosionFX_1.0.unitypackage
- 微擎1.7.5一键安装.zip
- BookManageSystem.rar
- 第4组_乐享购物.zip
- 全新裂变红包1.64破解版.zip
- CE.7z
- 微擎商业版1.8.2.zip
- awd_platform.7z
评论
共有 条评论