dbdown
dbup
のワークスペース シフトを反転する
説明
dbdown
は、デバッグ モードで、現在のワークスペースと関数コンテキストを、呼び出された MATLAB® 関数またはスクリプトのワークスペースと関数コンテキストに変更します。このコマンドを実行する前に、dbup
コマンドを少なくとも 1 回実行しなければなりません。dbdown
は dbup
の反対です。
複数の dbdown
コマンドは、現在のワークスペースと関数コンテキストが MATLAB の一時停止した行になるまで、スタック上で連続して実行される各 MATLAB 関数またはスクリプトにワークスペースと関数コンテキストを変更します。実行を続行したり、次の行にステップしたりするために、一時停止した行に戻る必要はありません。
例
現在のワークスペースと呼び出し元の関数のワークスペースを表示
dbup
コマンドと dbdown
コマンドを使用して、現在の関数のワークスペースと、その呼び出し元の関数のワークスペースを表示します。
次のステートメントを含むファイル myfile.m
を作成します。
function n = myfile(x) n = myfunc(x-1); function z = myfunc(y) z = 2/y;
myfunc
にブレークポイントを設定し、1
を入力して myfile
を実行します。MATLAB は関数 myfunc
の行 z = 2/y
で一時停止します。
dbstop in myfile>myfunc myfile(1);
5 z = 2/y;
whos
を呼び出して、現在のワークスペースの変数を表示します。
whos
Name Size Bytes Class Attributes y 1x1 8 double
ワークスペースには変数 y
が含まれ、これは myfunc
のワークスペースのコンテキストにあります。
dbup
コマンドを実行して、呼び出し元の関数 myfile
のワークスペースに切り替えます。whos
を呼び出して、新しいワークスペースの変数を表示します。
dbup whos
In workspace belonging to myfile (line 2) Name Size Bytes Class Attributes x 1x1 8 double
ワークスペースには変数 x
が含まれ、これは myfile
のワークスペースのコンテキストにあります。
dbdown
コマンドを実行してから、whos
を呼び出します。
dbdown whos
In workspace belonging to myfile>myfunc (line 5) Name Size Bytes Class Attributes y 1x1 8 double
ワークスペースには再び変数 y
が含まれ、これは myfunc
のワークスペースのコンテキストにあります。
複数のレベルを 1 ステップで下位に移動
dbup
コマンドと dbdown
コマンドを使用して、1 ステップで現在のワークスペースと関数コンテキストを、スタック上のいずれかのワークスペースと関数コンテキストに変更します。
次のステートメントを含むファイル myfile.m
を作成します。
function n = myfile(x) n = myfunc1(x-1); function m = myfunc1(y) m = myfunc2(2/y); function p = myfunc2(z) p = (z-1)/3;
myfunc2
にブレークポイントを設定し、1
を入力して myfile
を実行します。MATLAB は関数 myfunc2
の行 p = (z-1)/3
で一時停止します。
dbstop in myfile>myfunc2 myfile(1);
8 p = (z-1)/3;
whos
を呼び出して、現在のワークスペースの変数を表示します。
whos
Name Size Bytes Class Attributes z 1x1 8 double
ワークスペースには変数 z
が含まれ、これは myfunc2
のワークスペースのコンテキストにあります。
dbup
コマンドを実行してベース ワークスペースに切り替えます。whos
を呼び出して、新しいワークスペースの変数を表示します。
dbup 2
whos
In workspace belonging to myfile (line 2) Name Size Bytes Class Attributes x 1x1 8 double
ワークスペースには変数 x
が含まれ、これは myfile
のワークスペースのコンテキストにあります。
dbdown
コマンドを実行して、1 ステップで myfunc2
のワークスペースに切り替え、whos
を呼び出します。
dbdown 2
whos
In workspace belonging to myfile>myfunc2 (line 8) Name Size Bytes Class Attributes z 1x1 8 double
ワークスペースには再び変数 z
が含まれ、これは myfunc2
のワークスペースのコンテキストにあります。
入力引数
n
— 呼び出しスタックで移動するレベルの数
正の整数スカラー
呼び出しスタックで移動するレベルの数。正の整数スカラーとして指定します。
バージョン履歴
R2006a より前に導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)