Create txt file from each row of Matrix
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Rounak Saha Niloy
 el 15 de Mzo. de 2022
  
    
    
    
    
    Respondida: Rounak Saha Niloy
 el 15 de Mzo. de 2022
            I have a matrix D with size 3x7500. I want to generate separate text files with each row of matrix. How do I do this?
0 comentarios
Respuesta aceptada
Más respuestas (2)
  KSSV
      
      
 el 15 de Mzo. de 2022
        A = rand(3,10) ;
for i = 1:3
    fid = fopen([num2str(i),'.txt'],'w') ;
    fprintf(fid,'%f\n',A(i,:)) ;
    fclose(fid) ;
end
0 comentarios
  Arif Hoq
      
 el 15 de Mzo. de 2022
        A=randi(100,3,7500);
writematrix(A(1,:),'myfile1.txt')
writematrix(A(2,:),'myfile2.txt')
writematrix(A(3,:),'myfile3.txt')
0 comentarios
Ver también
Categorías
				Más información sobre MATLAB Coder en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


