fprintf for printing a matrix

17 ビュー (過去 30 日間)
Aftab Ahmed Khan
Aftab Ahmed Khan 2014 年 6 月 5 日
編集済み: Cedric 2014 年 6 月 5 日
Hi, I have a matrix name BS_channelTable of size (5,25) containg only zeros and ones. I want to print its element using a single fprintf command.
Just like if i just use the matrix name BS_channelTable in the command window.
  7 件のコメント
Star Strider
Star Strider 2014 年 6 月 5 日
Thanks! I wasn’t aware of that.
Something else you taught me!
Cedric
Cedric 2014 年 6 月 5 日
編集済み: Cedric 2014 年 6 月 5 日
I wouldn't recommend it as stderr should be kept for errors.. but if, like me, you make mistakes in most computations, then it can become legitimate to print to this stream ;-)

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

採用された回答

Star Strider
Star Strider 2014 年 6 月 5 日
This works:
fid = 1; % Insert true ‘fid’
BS_channelTable = randi([0 1], 5, 25); % Create data
fprintf(fid, [repmat(' %d ', 1, 25) '\n'], BS_channelTable')
  2 件のコメント
Aftab Ahmed Khan
Aftab Ahmed Khan 2014 年 6 月 5 日
Thanks strider,
nice to see you after few weeks.
Star Strider
Star Strider 2014 年 6 月 5 日
My pleasure!
Quite definitely you too!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by