필터 지우기
필터 지우기

Writing data into a file when using repmat

조회 수: 1 (최근 30일)
Ram
Ram 2011년 8월 26일
I have a set of data that I generate using repmat x=5; y=[repmat(x, 1, 5)];fn=fopen('A.txt', 'w');fprintf(fn, '%g\t%g\t%g\t%g\t%g\t\r\n', y)
How do I set it up so that I do not have to type in %g\t as many times as I am using in the repmat.
Thanks for any inputs

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 8월 26일
[repmat('%g\t',1,5),'\r\n']
  댓글 수: 3
Walter Roberson
Walter Roberson 2011년 8월 27일
fprintf(fn, [repmat('%g\t',1,x-1) '%g\r\n'], y);
Fangjun Jiang
Fangjun Jiang 2011년 8월 27일
@Ram, what are you trying to do exactly?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by