Main Content

plot

計画内のタスクのプロット

R2022b 以降

説明

plot(plan) は、計画内のタスクを依存関係グラフとしてプロットします。このグラフでは、ノードがタスクを表し、エッジが依存関係を表します。グラフ内のエッジは、依存するタスクから依存されるタスクに流れます。

プロットは、計画を有向非循環グラフとして可視化します。循環を含めることはできません。

入力引数

すべて展開する

計画。matlab.buildtool.Plan オブジェクトとして指定します。

すべて展開する

ビルド計画内のタスクを依存関係グラフとしてプロットします。

例を開き、ビルド ファイルが含まれる plot_plan_example フォルダーに移動します。

cd plot_plan_example

次のコードは、ビルド ファイルの内容を示しています。

function plan = buildfile
import matlab.buildtool.tasks.CodeIssuesTask
import matlab.buildtool.tasks.TestTask

% Create a plan from task functions
plan = buildplan(localfunctions);

% Add the "check" task to identify code issues
plan("check") = CodeIssuesTask;

% Add the "test" task to run tests
plan("test") = TestTask;

% Make the "archive" task the default task in the plan
plan.DefaultTasks = "archive";

% Make the "archive" task dependent on the "check" and "test" tasks
plan("archive").Dependencies = ["check" "test"];
end

function archiveTask(~)
% Create ZIP file
filename = "source_" + ...
    string(datetime("now",Format="yyyyMMdd'T'HHmmss"));
zip(filename,"*")
end

ビルド ファイルから計画を読み込みます。

plan = buildfile
plan = 
  Plan with tasks:

    archive - Create ZIP file
    check   - Identify code issues
    test    - Run tests

計画内のタスクを依存関係グラフとしてプロットします。グラフはタスクをノードとして表示します。"archive" タスクは "check" タスクと "test" タスクに依存するため、グラフには、これらの依存関係を表す 2 つのエッジも含まれます。

plot(plan)

Figure contains an axes object. The axes object contains an object of type graphplot.

バージョン履歴

R2022b で導入