Problem in format for a txt file output (non return to line)
조회 수: 2 (최근 30일)
이전 댓글 표시
Hy all, for a txt file output, i get an non return to line
V_Ref = {'Ref_1'; 'Ref_2'};
Nbr_Ref = length(V_Ref);
V_A1 = {'A_1'; 'A_2'}; V_A2 = {'B_2'; 'B_2'}; V_A3 = {'C_3'; 'C_2'};
V_B1 = {'D_1'; 'D_2'}; V_B2 = {'E_1'; 'E_2'}; V_B3 = {'F_1'; 'F_2'};
file_Out = fopen('My_OUT.txt','w');
for i=1:Nbr_Ref
M_A{i} = [V_Ref{i} V_A1{i} V_A2{i} V_A3{i}];
fprintf(file_Out,'%6s %12s %18s %24s \n',M_A{i});
M_B{i} = [V_Ref{i} V_B1{i} V_B2{i} V_B3{i}];
fprintf(file_Out,'%6s %12s %18s %24s \n',M_B{i});
end
fclose(file_Out);
I get this
Ref_1A_1B_2C_3 Ref_1D_1E_1F_1 Ref_2A_2B_2C_2 Ref_2D_2E_2F_2
But i want to get
Ref_1 A_1 B_2 C_3
Ref_2 A_2 B_2 C_2
Ref_1 D_1 E_1 F_1
Ref_2 D_2 E_2 F_2
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Electrical Block Libraries에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!