필터 지우기
필터 지우기

fprintf for printing a matrix

조회 수: 7 (최근 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 CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by