フィルターのクリア

fid value suppressing fprintf

2 ビュー (過去 30 日間)
Jeon
Jeon 2013 年 11 月 28 日
コメント済み: Jeon 2013 年 11 月 28 日
I'd like to make a program to display something when it is in a debug mode. Say,
fid = 0
fprintf(fid, 'do not display this')
fid = 1 % debug
fprintf(fid, 'print this')
I already know that 1 is for stdout, 2 is for stderr. However, it doesn't work when fid == 0.
And I am curious that which number suppresses fprintf?

採用された回答

Walter Roberson
Walter Roberson 2013 年 11 月 28 日
There is no fid the suppresses fprintf. Consider something like,
function dfprintf(DEBUG,varargin)
DEBUG && fprintf(varargin{:});
end
with a small bit of work you can make DEBUG a shared variable and use
dfprintf = @(varargin) DEBUG && fprintf(varargin{:});
  1 件のコメント
Jeon
Jeon 2013 年 11 月 28 日
Oh, that's sad. Thanks anyway.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by