请选择 进入手机版 | 继续访问电脑版

QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 6142|回复: 5

问一个有关MATLAB工具箱里面函数不能正常使用的问题。

[复制链接]
字体大小: 正常 放大

9

主题

4

听众

1673

积分

升级  67.3%

  • TA的每日心情
    奋斗
    2018-4-11 22:36
  • 签到天数: 490 天

    [LV.9]以坛为家II

    邮箱绑定达人

    发表于 2014-5-20 01:05 |显示全部楼层
    |招呼Ta 关注Ta |邮箱已经成功绑定
    本人电脑装的MATLAB装的7.0,toolbox里面有一个自带的window.m函数。现在由于做毕设需要添加了一个时频分析工具箱tftb(time-frequencytoolbox ),里面有五个子文件夹,都通过MATLAB的file->set path->add withsubfolders添加进去了。tftb工具箱有一个子文件夹mfiles里面也有一个交window.m的函数。现在要运行毕设要用的程序,需调用到tftb->mfile里面的window函数,但运行之后却出现了这样的提示:Warning: Functioncall window invokes D:\MATLAB7\toolbox\signal\signal\window.m,however,function D:\MATLAB7\toolbox\mfiles\WINDOW.Mthat differs only in case precedes it on the path.看出来系统运行的还是signal工具箱里面的window函数,当然后面紧接着一堆的报错,都是由于这个原因,因为signal工具箱里面的window函数与tftb工具箱里面的window函数格式用法完全不一样,运行过程中出现矛盾了。好,既然先运行signal,那么现在把新的window函数直接复制粘贴到signal工具箱里面替换掉原来的,再运行,结果又报错。唉,都不知道该怎么办了。。。
    1 I- w  R1 n+ z6 r请问各位知友怎么解决这个问题呢?马上要交论文了,急得要死,老师也不怎么管,唉。。。。。。如果能把这个问题解决了,程序肯定就能够正常运行起来。
    zan
    暂无签名。

    9

    主题

    4

    听众

    1673

    积分

    升级  67.3%

  • TA的每日心情
    奋斗
    2018-4-11 22:36
  • 签到天数: 490 天

    [LV.9]以坛为家II

    邮箱绑定达人

    回复

    使用道具 举报

    9

    主题

    4

    听众

    1673

    积分

    升级  67.3%

  • TA的每日心情
    奋斗
    2018-4-11 22:36
  • 签到天数: 490 天

    [LV.9]以坛为家II

    邮箱绑定达人

    回复

    使用道具 举报

    madio        

    3万

    主题

    1307

    听众

    5万

    积分

  • TA的每日心情
    奋斗
    2021-5-1 20:26
  • 签到天数: 2013 天

    [LV.Master]伴坛终老

    自我介绍
    数学中国站长

    社区QQ达人 邮箱绑定达人 优秀斑竹奖 发帖功臣 风雨历程奖 新人进步奖 最具活力勋章

    群组数学建模培训课堂1

    群组数学中国美赛辅助报名

    群组Matlab讨论组

    群组2013认证赛A题讨论群组

    群组2013认证赛C题讨论群组

    MATLAB中不同工具包.m文件重名的解决办法
    频道:技术文章 发布时间:2012-6-19 阅读量:2968
    0 V4 D3 A: {! \6 c
    一、问题描述
    % P, a# s# x( E2 U5 R$ `, s6 nMATLAB使用搜索路径来查找.m文件及其他相关文件。任何你想运行的文件必须保存在当前目录或保存在处于探索路径上的目录中。默认情况下,每次启动MATLAB时,都使用位于matlabroot\toolbox\local目录中的pathdef.m定义搜索路径。
    . P: L! k9 w2 k0 r5 k/ B# O在这多用户的情况下,有一个潜在的问题——不同的用户使用不同的工具包,这些工具包可能有同名的.m文件,那么只有处于搜索路径前面的.m文件会被执行,另一个.m文件,永远不会被执行。4 H& T* a( f, O4 R/ s0 V) Z
    比如,我们的MATLAB中,同时安装了dynare(4.2.4)和Lesage空间计量模型(2010),这两个工具中均包含有hessian.m这个文件。而在MATLAB的搜索路径(search path)中,dynare排在Lesage空间计量模型前面,这样,默认情况下你就无法使用Lesage空间计量模型中的hessian.m。
    + g- A, j9 j( i二、解决方法" _* w6 w+ l3 T% V
    (一)在本机临时更改搜索路径  z1 l  j& x! l' ?/ r
    将你所需的同名的M文件放到搜索路径的最前面/ z/ @  \% K( i) d- o3 R
    path('<your .m path>',path)' k* |4 c4 B6 U  N
    如果原先<your .m path>已经存在于搜索路径中,则该目录会被移至搜索路径最前面。
    3 v5 w- w$ h7 v; w( U4 g如果要在搜索路径中包含指定目录的子目录,可以先使用genpath得到所有子目录,再用path命令,如path(genpath('d:\yuan\documents\matlab'),path)。9 h( g: q5 F' W% A6 ^: p
    或者是删除造成同名的另一个工具包路径& ]0 n* S4 X( m3 t
    if findstr('<造成同名的另一工具包路径>',path)
    ) v0 m' X$ B0 e1 W+ Ormpath('<造成同名的另一工具包路径>')
    $ t2 v/ e5 j4 {7 k( }2 U) p9 Mend& M+ k# g7 J- x+ _' S7 R6 K9 m
    以上更改并没有保存下来,MATLAB进程关闭后重启,将恢复默认搜索路径。
    3 q' l- H) z# `; s( K(二)在本机自定义搜索路径
    / f7 h. S9 Y( |, h) A1 ]+ H5 y1.通过pathdef.m
    + a. O' A) I! g4 |2 m如果pathdef.m在MATLAB的启动目录中(Startup Folder),则MATLAB通过启动目录中的pathdef.m定义搜索路径。因此当我们将matlabroot\toolbox\local中的pathdef.m拷贝到启动目录中,启动MATLAB进程,单击File-->Set path,根据需要设置并保存。' k# p" }/ l- \' F6 M2 [' U- D
    关于Startup Folder的信息,请参见“三、参考阅读”部分。7 ~3 ^9 N, O9 l0 d- |) f, [  b
    2.通过startup.m
    2 g  J& a2 c' M+ a可以通过startup.m指定启动选项,如可以在startup.m中加入修改路径的相关语句,然后将startup.m放到Startup Folder中,或放到搜索路径中的任何一个文件夹中。
    ' H' h9 g# J6 h4 u! Y5 t
      [$ A* U! I3 H  D* p如果你需要在本机同时启动一个以上MATLAB进程,且每个进程都有不同的自定义搜索路径,则可以先建立多个启动MATLAB的快捷方式,然后修改其Startup Folder
    3 z* f4 ^+ G' c- _8 E5 U/ i1 q然后将pathdef.m放到每个进程指定的Startup Folder中。双击每个快捷方式,启动MATLAB后,再通过File-->Set path修改各自的搜索路径并保存。
    3 j) H6 X' [! e) I, e5 x或者将自定义的startup.m放到指定的Startup Folder中。. J" }) ~: m3 Y" V4 l5 c6 U" H+ F: ~
    (三)在worker或lab上自定义搜索路径% a2 M1 F0 }! a, D" L8 o4 m# T
    当进行分布式或并行计算时,计算任务可能提交到其他计算节点,这时自定义搜索路径的方法至少有以下几种方法:( i  |  ^3 y$ |9 }* u/ d: L, O9 H
    1.通过jobStartup.m
    . _+ B- g4 J6 G/ G1 T2 w将matlabroot\toolbox\distcomp\user中的jobStartup.m拷贝到作业的PathDependencies属性所指定的目录中,然后使用修改路径的相关语句,如:
      V% _/ R; R1 a/ U8 kpath('<your .m path>',path) 将你所需的同名的M文件放到搜索路径的最前面;. b1 |4 x, \+ [# K4 ~( M( G
    rmpath('<造成同名的另一工具包路径>')  删除造成同名的另一个工具包路径。
    ' T4 e9 X5 |: F* }! h7 P3 c注:在我们的HPC系统中,所有节点(登录节点和计算节点)的MATLAB默认搜索路径都是相同的。; _: `3 w2 D; B
    2.通过设定作业的PathDependencies属性9 Q8 ^" v7 L: R4 n' Z
    PathDependencies所指定的目录会自动加入Worker搜索路径的最前面。
    0 \8 ^4 o& @, d9 }/ O6 w- E作业的PathDependencies默认指向Z:\User\Documents\MATLAB\,且它是一个1*1的Cell Array。7 G* {* Q, x2 r* `* O
    如何将其他目录加入到PathDependencie列表?/ R7 q4 ]/ P3 N$ K
    方法一:下面的语句将Z:\User\Documents\MATLAB中的Other目录添加到PathDependencie列表中
    ' A/ b( r$ f% f. Q, Bj.pathdependencies=[j.pathdependencies;'Z:\User\Documents\MATLAB\Other']
    5 a. z+ T0 N( ]之后,j.PathDependencie就是2*1的Cell Array了。
    9 x0 E/ ~% B( Z/ ~4 k; @+ H● 方法二:下面的语句将Z:\User\Documents\MATLAB及其子目录替代原有的PathDependencie列表
    # w. m$ j( R; D. r  ~* k7 E6 y5 pp=textscan(genpath('Z:\User\Documents\MATLAB'),'%s','delimiter',';');0 N4 H" D4 |1 w, n; A
    j.pathdependencies= p{1,1};: U/ f  I- Z" e! h4 ]% Q2 ~
    3.在计算程序(.m)中直接修改搜索路径
    * I+ s: g( H3 Q* V在每个task所指定的.m文件中,直接加入addpath或rmpath等相关命令修改搜索路径。- ]- }, y6 d! X
    三、参考阅读# U/ ^( k: K8 f$ f- d9 l# J
    (一)Function Precedence Order# d5 U* J% f$ M8 V/ Y) L/ v
    1. Variable+ N$ K6 I% K2 Y1 W& n+ v
    2. Nested Function2 E4 I5 t1 b3 z+ R; I& A$ p5 c" ?
    3. Subfunction
    " h) P+ p* e5 i4 f! K0 S4. Private function
    7 W( r) p: t# ]0 B6 t$ d# X) @8 x5. Class constructor
    0 B1 [! t$ A+ d1 R; j1 d6. Overloaded method7 M3 c& i5 _" v4 I7 F2 n
    7. MATLAB function file in the Current Folder' H3 b: c/ x8 F
    8. MATLAB function file on the path, or MATLAB built-in function5 ?" ], r( u/ c" n- k3 l( p
    For items 4 through 8 in this list, the file MATLAB searches for can be any of four types: a built-in file or program file with a .m file extension, preparsed program file (P-Code), compiled C or Fortran file (MEX-file), or Simulink® model (MDL-file).6 C5 _4 z" N, b! I) f1 G8 [
    Multiple Implementation Types
    ! Q- d- o4 J3 P5 MThere are five file precedence types. MATLAB uses file precedence to select between identically named functions in the same folder. The order of precedence for file types is$ }0 K4 o1 ?' E' L" Y8 q
    1. Built-in file: N2 E7 D4 Q, ^/ O
    2. MEX-files
    + R, z( t+ `9 t- J) h3. MDL (Simulink® model) file5 r+ h8 h3 n  V+ w2 G. l$ j7 A; K& Q
    4. P-code file: E: L% u& P4 l7 S+ v* U
    5. Program file with a .m file extension
    * T& B/ r& k5 y  R" W: u2 m! D(二)current folder、startup folder、userpath
    ) `0 \) R+ ~+ Q& J. i1. current folder
    + T, I  V% L. r即当前目录
    1 Y. O0 c1 D$ p6 y4 }, @: [: Q6 \- X! v- i  V
    2. startup folder
    - `1 p1 |8 }% H# r2 X(1)什么是startup folder1 Q" P( N5 F' I1 D' x
    The startup folder is the current folder in the MATLAB application when it starts. It is convenient if you make the current folder upon startup be a folder that you frequently use. On Windows and Apple Macintosh platforms, a folder called userpath is added automatically to the search path upon startup, and is the default startup folder.
    / G- q- ^9 a( Y" jThe startup folder on Windows platforms depends on any startup options you specified and the way you started MATLAB:
    " V% R% Q; Y) g( L* o' V6 y
    + @8 _1 a: L3 |1 U) `* K
    How Started' H% p5 z4 l& O5 }  U) |( m" m
    Startup Folder
    4 {+ _& w8 s% O* V" r7 @) n
    Double-click the MATLAB shortcut on your Windows desktop, D, J) d6 {/ y5 ]
    The startup folder is set to the userpath value, whose default value is My Documents\MATLAB, or Documents\MATLAB on Windows Vista platforms. The userpath folder is automatically added to the search path. If there is a value specified in the Start in field of the Properties dialog box for the MATLAB program, that value is the startup folder, although the userpath is added to the search path. If MATLAB does not find a valid userpath value upon startup, and the Start in field is empty, the startup folder is the Windows desktop./ ^( |& Z$ S2 l! ~( R# o
    Double-click a file type associated with MATLAB
    / Z9 }" K8 S2 I( ?4 P0 l$ L
    The folder in which the file resides is the startup folder. The userpath folder is automatically added to the search path.
    * H! _) P" s% E* v6 Z
    In a DOS window
    8 Z6 Z; e: \  r3 x" @- E, J) p
    The folder in which you ran the command is the startup folder. The userpath folder is automatically added to the search path.
    . _( Y0 |% |' l( L5 t  l* n6 i
    9 w4 d. e1 b  `
    (2)更改startup folder
    - d# K; ?7 W: q①通过userpath函数修改' d; i. Q+ C$ b; N( p  O
    默认情况下,userpath即是startup folder,所以可以通过userpath来更改。一般不建议修改userpath。, [- D7 X# Q5 j6 U8 f: H
    ②在Windows平台下,通过快捷方式属性修改。
    & |+ y& |% R1 X& k8 W右键单击快捷方式,选“属性”,打开如下对话框,将“起始位置(start in)”改为另外一个目录,如D:\HPCUserFile\yuan\Matlab。HPC二期的默认的起始位置是Z:\User\Documents\MATLAB。
      X  \' N' C: C' x. b+ E
    8 \2 g/ z. n! }9 ]4 G8 r8 \③通过startup.m文件修改
    . x$ B) ?7 ]3 m7 M0 H* c+ ^0 yAt startup, MATLAB automatically executes the file matlabrc.m and, if it exists, startup.m. The file matlabrc.m, which is in the matlabroot/toolbox/local folder, is reserved for use by MathWorks and by the system manager on multiuser systems.
    3 ?4 W8 Q# m4 R! D# Z3 hThe file startup.m is for you to specify startup options. For example, you can modify the default search path, predefine variables in your workspace, or define defaults for Handle Graphics® objects. Use the following statements in a startup.m file to add the specified folder, D:\, to the search path, and to change the current folder to D:\ upon startup. Place the file in the default or current startup folder, which is where MATLAB first looks for it. You can place it in any other search path of MATLAB session.9 ]$ j* ?/ a# K7 q$ w5 E5 \3 a! j
    addpath D:\2 \9 ?/ Z2 ]' p# u
    cd D:\3 V0 O3 S+ G9 D+ [3 l/ F/ h) ^. A
    3. userpath# @- t7 @- d/ C. p
    User environment path, on Windows, it is the user's "Documents" (or "My Documents" on WinXP) folder appended with "MATLAB".; J' P. r& Z/ L& x& ~7 B

    + |. Z2 L7 P- L2 y) ~* C$ j" Q
    数学建模社会化
    回复

    使用道具 举报

    madio        

    3万

    主题

    1307

    听众

    5万

    积分

  • TA的每日心情
    奋斗
    2021-5-1 20:26
  • 签到天数: 2013 天

    [LV.Master]伴坛终老

    自我介绍
    数学中国站长

    社区QQ达人 邮箱绑定达人 优秀斑竹奖 发帖功臣 风雨历程奖 新人进步奖 最具活力勋章

    群组数学建模培训课堂1

    群组数学中国美赛辅助报名

    群组Matlab讨论组

    群组2013认证赛A题讨论群组

    群组2013认证赛C题讨论群组

    MATLAB中不同工具包.m文件重名的解决办法
    频道:技术文章 发布时间:2012-6-19 阅读量:2968
    1 ?5 \) R  O. Z2 B  i* m
    一、问题描述
    % j% s7 d2 p& S9 Y* k/ |MATLAB使用搜索路径来查找.m文件及其他相关文件。任何你想运行的文件必须保存在当前目录或保存在处于探索路径上的目录中。默认情况下,每次启动MATLAB时,都使用位于matlabroot\toolbox\local目录中的pathdef.m定义搜索路径。$ C: T: K7 S/ h- r1 {
    在这多用户的情况下,有一个潜在的问题——不同的用户使用不同的工具包,这些工具包可能有同名的.m文件,那么只有处于搜索路径前面的.m文件会被执行,另一个.m文件,永远不会被执行。
    3 N' j8 q' w/ H, x4 S( U7 V比如,我们的MATLAB中,同时安装了dynare(4.2.4)和Lesage空间计量模型(2010),这两个工具中均包含有hessian.m这个文件。而在MATLAB的搜索路径(search path)中,dynare排在Lesage空间计量模型前面,这样,默认情况下你就无法使用Lesage空间计量模型中的hessian.m。7 h) a2 A: t  s% f' L# T8 r
    二、解决方法' Y3 Z% N' P/ K& @( a" S
    (一)在本机临时更改搜索路径; P1 N$ T  w" p& k5 F) P
    将你所需的同名的M文件放到搜索路径的最前面
    6 C, R4 g9 i$ Y& G- t% h+ \path('<your .m path>',path)# j# {5 A# H0 }; O
    如果原先<your .m path>已经存在于搜索路径中,则该目录会被移至搜索路径最前面。
    ) w( C* u0 r8 ^3 V. Y- p- G" q如果要在搜索路径中包含指定目录的子目录,可以先使用genpath得到所有子目录,再用path命令,如path(genpath('d:\yuan\documents\matlab'),path)。: y- s- X9 L& V) ]9 }! o" |
    或者是删除造成同名的另一个工具包路径+ |# |8 q9 V7 ?/ m% r# U
    if findstr('<造成同名的另一工具包路径>',path)+ M7 g. P- @: p
    rmpath('<造成同名的另一工具包路径>')
    - r9 H9 v( a: F. |% T/ Hend4 j5 X8 B8 z- [8 H+ v# O
    以上更改并没有保存下来,MATLAB进程关闭后重启,将恢复默认搜索路径。
    . F: @; P2 }& e- J9 n2 q$ p- G7 o1 f(二)在本机自定义搜索路径
    8 Q; m/ E) k& O8 w) |' U) {% e& i1.通过pathdef.m
    ) \  Q( i1 H6 ]. r8 l9 I' `/ v; G如果pathdef.m在MATLAB的启动目录中(Startup Folder),则MATLAB通过启动目录中的pathdef.m定义搜索路径。因此当我们将matlabroot\toolbox\local中的pathdef.m拷贝到启动目录中,启动MATLAB进程,单击File-->Set path,根据需要设置并保存。% s: l. ]2 M% f$ v% T9 W
    关于Startup Folder的信息,请参见“三、参考阅读”部分。
    ( J: T2 r# T" w) W2 r2.通过startup.m! `9 J  R% ^" A/ d& p9 |1 o- {( g
    可以通过startup.m指定启动选项,如可以在startup.m中加入修改路径的相关语句,然后将startup.m放到Startup Folder中,或放到搜索路径中的任何一个文件夹中。. T, S" T. u" D8 k  e9 q# y
    5 S: }$ a7 S5 @+ `3 R  i
    如果你需要在本机同时启动一个以上MATLAB进程,且每个进程都有不同的自定义搜索路径,则可以先建立多个启动MATLAB的快捷方式,然后修改其Startup Folder0 x6 A& l9 T3 F# u
    然后将pathdef.m放到每个进程指定的Startup Folder中。双击每个快捷方式,启动MATLAB后,再通过File-->Set path修改各自的搜索路径并保存。7 \( l0 X/ ?6 h. F5 m' {  y2 _
    或者将自定义的startup.m放到指定的Startup Folder中。
    / S# C, ?3 S$ B7 `/ w. i(三)在worker或lab上自定义搜索路径6 A8 `1 l8 R; `3 |2 @) N8 h  q
    当进行分布式或并行计算时,计算任务可能提交到其他计算节点,这时自定义搜索路径的方法至少有以下几种方法:3 S1 o6 o; x2 P# h  D
    1.通过jobStartup.m
    + ]+ j1 v/ H( i' u" T/ W. z# ~将matlabroot\toolbox\distcomp\user中的jobStartup.m拷贝到作业的PathDependencies属性所指定的目录中,然后使用修改路径的相关语句,如:
    8 _1 N2 Z6 m2 j' f( Ipath('<your .m path>',path) 将你所需的同名的M文件放到搜索路径的最前面;
    5 }  y+ l, x9 |2 _+ i9 Prmpath('<造成同名的另一工具包路径>')  删除造成同名的另一个工具包路径。2 ?4 B9 |- z% s4 N3 ~7 l
    注:在我们的HPC系统中,所有节点(登录节点和计算节点)的MATLAB默认搜索路径都是相同的。
    ( f$ J( p6 B$ @+ ~1 ]2.通过设定作业的PathDependencies属性
    , ]; N0 O. s# _" t3 H2 ]( }" wPathDependencies所指定的目录会自动加入Worker搜索路径的最前面。
    & g, ?8 Q& g. N) b/ E2 U作业的PathDependencies默认指向Z:\User\Documents\MATLAB\,且它是一个1*1的Cell Array。1 _' o8 i) a1 C* d
    如何将其他目录加入到PathDependencie列表?; S! ~' T1 ^1 \! J
    方法一:下面的语句将Z:\User\Documents\MATLAB中的Other目录添加到PathDependencie列表中2 v0 q5 G, ^/ F: @
    j.pathdependencies=[j.pathdependencies;'Z:\User\Documents\MATLAB\Other']
    + }- h* y. s! t3 R之后,j.PathDependencie就是2*1的Cell Array了。% |* J; Z. b7 P) y' h
    ● 方法二:下面的语句将Z:\User\Documents\MATLAB及其子目录替代原有的PathDependencie列表
    8 \- r2 t7 }7 K$ R6 n. X  Y6 Qp=textscan(genpath('Z:\User\Documents\MATLAB'),'%s','delimiter',';');
    $ H6 K! v' J) yj.pathdependencies= p{1,1};) f+ {+ r; x1 k$ }- v
    3.在计算程序(.m)中直接修改搜索路径
    5 n+ ], m1 Z. `$ ~0 }在每个task所指定的.m文件中,直接加入addpath或rmpath等相关命令修改搜索路径。
    6 h& L5 s. c% a4 M* K三、参考阅读: K6 k+ z' p5 M) Z( o' }5 ^$ u
    (一)Function Precedence Order
    & A( T% {# m0 o: `+ i3 N1. Variable
      O$ L: C$ t" m7 H+ q, }' t2. Nested Function/ W: p+ W  h, t( i2 V! E+ U
    3. Subfunction
    5 {5 X3 u, w$ H: }( Q  B4. Private function+ L) j9 Y' ~. |4 {2 Q2 I6 A7 e
    5. Class constructor
    ; M( u$ V1 k8 X2 c$ `/ o1 J6. Overloaded method4 i) l" }$ K" G5 M1 `% c/ G
    7. MATLAB function file in the Current Folder; H+ s. I3 F, I: X( x- z
    8. MATLAB function file on the path, or MATLAB built-in function" K% w' ?9 j9 ~: v  [7 u; }3 J" ]! r6 H
    For items 4 through 8 in this list, the file MATLAB searches for can be any of four types: a built-in file or program file with a .m file extension, preparsed program file (P-Code), compiled C or Fortran file (MEX-file), or Simulink® model (MDL-file).
    9 Z4 y. w6 ~, Q7 Q& [2 E& R+ R, ?Multiple Implementation Types
    # b0 r+ \9 F+ Q% u8 YThere are five file precedence types. MATLAB uses file precedence to select between identically named functions in the same folder. The order of precedence for file types is
      m/ g) p8 R/ x( O1. Built-in file4 g0 \" Y9 X2 c8 y( f3 ]! l
    2. MEX-files8 W% e7 K4 G% b- L1 X3 ]1 X( L  n
    3. MDL (Simulink® model) file2 Y7 N0 [% Z; s, t8 ]
    4. P-code file- M0 Y  v, z, x: V" V9 _$ N
    5. Program file with a .m file extension
    4 f; I, g" ?! g8 g(二)current folder、startup folder、userpath
    . H# i- W+ ~2 U, L8 c% N6 e1 D1. current folder
    : V  P% G9 m1 T+ @即当前目录! b; ?8 c7 W( K9 P9 E# W$ v

      \4 T7 x% a: V* ?5 W2. startup folder. O% y- h1 W  M3 J" d2 L
    (1)什么是startup folder- V( r  T3 P6 I% @. m8 o
    The startup folder is the current folder in the MATLAB application when it starts. It is convenient if you make the current folder upon startup be a folder that you frequently use. On Windows and Apple Macintosh platforms, a folder called userpath is added automatically to the search path upon startup, and is the default startup folder.
    * @. ~( v# m" P  d4 |+ t% uThe startup folder on Windows platforms depends on any startup options you specified and the way you started MATLAB:
    * Q  i8 l4 M( T$ a# P9 {7 g) D
    9 Q2 r' x% |' `6 d8 [% B$ b" B
    How Started
    8 T& t" J  n& S/ t  L9 c7 P9 U
    Startup Folder
    % F0 N" Q) U( h1 V9 ~' M0 X& _7 ?
    Double-click the MATLAB shortcut on your Windows desktop
    ! N+ A& S& M0 R; C2 x# |1 n& H
    The startup folder is set to the userpath value, whose default value is My Documents\MATLAB, or Documents\MATLAB on Windows Vista platforms. The userpath folder is automatically added to the search path. If there is a value specified in the Start in field of the Properties dialog box for the MATLAB program, that value is the startup folder, although the userpath is added to the search path. If MATLAB does not find a valid userpath value upon startup, and the Start in field is empty, the startup folder is the Windows desktop.
    2 J- H! x8 G9 X/ [" c3 w" T1 I
    Double-click a file type associated with MATLAB
    5 k  U1 ^5 T1 X. V
    The folder in which the file resides is the startup folder. The userpath folder is automatically added to the search path.' f& }! S8 l& Y. l% [- z, a; W
    In a DOS window0 R2 K9 l# w- ^7 |
    The folder in which you ran the command is the startup folder. The userpath folder is automatically added to the search path.
    . \. @8 |. C6 V

    4 H4 e0 |+ E+ P, \/ A5 F' C(2)更改startup folder
    7 @7 d/ u# U9 C①通过userpath函数修改& }* L+ ]! l- R5 V; e
    默认情况下,userpath即是startup folder,所以可以通过userpath来更改。一般不建议修改userpath。* N% @( g" {6 r2 d* U  G, I/ N3 |
    ②在Windows平台下,通过快捷方式属性修改。
    # k! k- @. L4 l2 o3 L右键单击快捷方式,选“属性”,打开如下对话框,将“起始位置(start in)”改为另外一个目录,如D:\HPCUserFile\yuan\Matlab。HPC二期的默认的起始位置是Z:\User\Documents\MATLAB。
    , X9 h5 v* c' g9 w5 w/ i" @+ }0 Y. ^
    ③通过startup.m文件修改0 w8 C! A3 R6 T* l# Y9 W1 f/ E
    At startup, MATLAB automatically executes the file matlabrc.m and, if it exists, startup.m. The file matlabrc.m, which is in the matlabroot/toolbox/local folder, is reserved for use by MathWorks and by the system manager on multiuser systems.
    . {) w* d: \7 h. f: CThe file startup.m is for you to specify startup options. For example, you can modify the default search path, predefine variables in your workspace, or define defaults for Handle Graphics® objects. Use the following statements in a startup.m file to add the specified folder, D:\, to the search path, and to change the current folder to D:\ upon startup. Place the file in the default or current startup folder, which is where MATLAB first looks for it. You can place it in any other search path of MATLAB session.4 _" l( H' N# v
    addpath D:\
    , J% M* j7 z7 _6 X7 xcd D:\
    ' R: ]: L! N* G7 x1 x" E3. userpath
    1 y# u, A, p& c; B) rUser environment path, on Windows, it is the user's "Documents" (or "My Documents" on WinXP) folder appended with "MATLAB".! K) E+ u. \) I& [$ k
    7 h6 X3 S3 n/ w1 k% |6 K

    4 a2 s) q1 C1 S
    数学建模社会化
    回复

    使用道具 举报

    9

    主题

    4

    听众

    1673

    积分

    升级  67.3%

  • TA的每日心情
    奋斗
    2018-4-11 22:36
  • 签到天数: 490 天

    [LV.9]以坛为家II

    邮箱绑定达人

    唉,发现把自带的window函数删除,设置好路径后必须要重启一下MATLAB才行,不重启还是要报错,MATLAB7就是坑啊。
    暂无签名。
    回复

    使用道具 举报

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

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

    关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

    手机版|Archiver| |繁體中文 手机客户端  

    蒙公网安备 15010502000194号

    Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

    GMT+8, 2024-3-29 21:03 , Processed in 0.655752 second(s), 76 queries .

    回顶部