#author("2017-08-03T16:09:18+09:00","default:Miyashita","Miyashita") #author("2018-07-25T20:49:45+09:00","default:Miyashita","Miyashita") *コマンドラインからのpathの追加と保存 [#y5a23d73] 遠隔操作でGUIを使わずにpathを追加する方法.~ 使うfunctionは,genpath, addpath, savepathの3つ.~ genpath(mypath) #codeprettify(lang-matlab){{ genpath(mypath) }} とすることで,mypathという階層以下全てのpathがテキストとして出力される.~ これを利用して, addpath(genpath(mypath),'-end') #codeprettify(lang-matlab){{ addpath(genpath(mypath),'-end') }} とすると,mypath以下のサブディレクトリも含めたpathの追加が可能.~ '-end'は無くともOKだが,後に確認しやすい.~ 再起動時まで反映させるためには,このパスの状況を保存させる必要がある.~ path一覧を管理しているのはpathdef.mというファイルであり,大抵はrootディレクトリにあるはず(OSがLinuxの場合).~ 通常rootディレクトリ内のファイルはMATLABのコマンドでは編集できないため, savepath pathdef.m #codeprettify(lang-matlab){{ savepath pathdef.m }} で一度カレントディレクトリにpathdef.mを生成させ,後にterminalで移動させるのが無難. # Ubuntuのterminalでやるとすれば sudo cp -p pathdef.m /usr/local/MATLAB/R2016a/toolbox/local/pathdef.m #codeprettify{{ # Ubuntuのterminalでやるとすれば sudo cp -p pathdef.m /usr/local/MATLAB/R2016a/toolbox/local/pathdef.m }}