Info

This question is closed. Reopen it to edit or answer.

writre letter and number matrix to text file

1 view (last 30 days)
Ahmad
Ahmad on 27 Oct 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
hi all I have a matrix with this form and it may differ in column length and I want to extract it to text file as it is I tried dlmwrite,fprintf with repmat and it write the matrix an numbers and binaries
while the matrix is >> Mother_Matrix
and this is my trial
Mother_Matrix(:,35)='0';
fclose (fid);
fclose all;
A=Mother_Matrix;
str=char(sprintf('NumQk %s EGYPT %s0 ENSN NRIAG', DATE, OT));
filename=fullfile('F:\','outfile.txt');
fid=fopen(filename,'a+');
fprintf(fid,'%s\n',str);
for ii=1:size(A,2) if ii<=size(A,2) fprintf(fid,'%s\t',A(1,:)); end end
--------------------------------------------
[rows cols] = size(A);
x = repmat('%s\t',1,(cols-1));
fprintf(fid,[x,'%d\n'],A');
fclose(fid);
%dlmwrite(filename,'%s\n',Mother_Matrix);
>>>>>> so please could any one help me to extract the matrix as it is in the formate

Answers (0)

Community Treasure Hunt

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

Start Hunting!