alignment issue in fprint
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kareemulla Dudekula
el 24 de En. de 2022
Comentada: Rik
el 24 de En. de 2022
My fprintf table is not aligned
P=[65.44; 87.12; 67.46; 79.51];
words1={'Moisture';'Fixed carbon';'Volatile matter';'Ash'};words2 = repmat({'wt%'},length(P),1);
D={words1,P,words2};
for k1 = 1:size(words1,1);
fprintf('%s \t %.2f \t %s \n',char(D{1}(k1)),D{2}(k1,:),char(D{3}(k1)))
end
excecutes as follows:
Moisture 65.44 wt%
Fixed carbon 87.12 wt%
Volatile matter 67.46 wt%
Ash 79.51 wt%
Could someone please help in figuring out how to align the strings and digits.
0 comentarios
Respuesta aceptada
yanqi liu
el 24 de En. de 2022
P=[65.44; 87.12; 67.46; 79.51];
words1={'Moisture';'Fixed carbon';'Volatile matter';'Ash'};
words2 = repmat({'wt%'},length(P),1);
D={words1,P,words2};
for k1 = 1:size(words1,1);
fprintf('%20s \t %.2f \t %s \n',char(D{1}(k1)),D{2}(k1,:),char(D{3}(k1)))
end
2 comentarios
Más respuestas (1)
KSSV
el 24 de En. de 2022
P=[65.44; 87.12; 67.46; 79.51];
words1={'Moisture';'Fixed carbon';'Volatile matter';'Ash'};
words2 = repmat({'wt%'},length(P),1);
T = table(words1,P,words2)
0 comentarios
Ver también
Categorías
Más información sobre Logical 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!