Problem in format for a txt file output (non return to line)

1 次查看(过去 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

采纳的回答

Walter Roberson
Walter Roberson 2016-4-2
M_A = {V_Ref{i} V_A1{i} V_A2{i} V_A3{i}};
fprintf(...., M_A{:})
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Electrical Block Libraries 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by