Save 512x512 matrix to text file
    조회 수: 6 (최근 30일)
  
       이전 댓글 표시
    
Dear all,
I try to save an 512x512 matrix of lena image into text file, which will be used for fpga processing.
I have use the recommended code:
A = round(rand(6,7)*9) % Write this to file.
fid = fopen('Mymatrix.txt','wt');
for ii = 1:size(A,1)
fprintf(fid,'%g\t',A(ii,:));
fprintf(fid,'\n');
end
fclose(fid)
However, the output file miss many coefficients.
Is there any method to create an complete text file with tab between coefficients ?
Thank you
댓글 수: 0
답변 (1개)
  Ahmed A. Selman
      
 2013년 4월 27일
        This code works perfectly. To check it add the following at the very end of the above code:
fid = fopen('Mymatrix.txt','r');
[A1,n]=fscanf(fid,'%g %g',[7 inf]);
fclose(fid);
fprintf(1,'Data being fed from the file is :\n')
A1'
and compare A1 with (the original data) A.
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

