LoginSignup
12
8

More than 3 years have passed since last update.

Mファイルの依存関係を確認

Last updated at Posted at 2020-03-20

はじめに

今回は,mファイルの依存関係を確認する方法についてメモします。

コード

target.mというファイルがどの関数やクラスに依存しているかを調べるには,以下のコードを実行します。

file = 'target.m';                                       % 対象ファイル名を設定
flist = matlab.codetools.requiredFilesAndProducts(file); % リストの取得
disp(string(flist).');                                   % 文字列に変換し,表示

おわりに

自作のライブラリの整理などを行う際にご活用ください。
また,Qiitaなどに投稿する前に確認するのにも使えるかもしれませんね。

おまけ

必要なツールボックスについての情報が必要な場合には,以下のコードで取得できます。

file = 'target.m';                                            % 対象ファイル名を設定
[~, plist] = matlab.codetools.requiredFilesAndProducts(file); % リストの取得
disp(string({plist.Name}).');                                 % 文字列に変換し,表示

参考文献

matlab.codetools.requiredFilesAndProducts (公式ドキュメント)

12
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
8