How to write a multi line string?

17 visualizaciones (últimos 30 días)
Jay Vaidya
Jay Vaidya el 5 de Ag. de 2020
Respondida: Star Strider el 5 de Ag. de 2020
I want to print the following with all the characters in a file. I thought of using strvcat for this as it is a multiline string.
tran_models = strvcat({'.MODEL pcg PMOS( LEVEL=1 VTO=-0.45 KP=11.9 GAMMA=1.24 ',
'+ PHI=.75 LAMBDA=386u RD=21.0m RS=21.0m ',
'+ IS=750f PB=0.800 MJ=0.460 CBD=81.1p ',
'+ CBS=97.4p CGSO=720n CGDO=600n CGBO=1.88u )'});
fprintf(File,'%s\n', tran_models);
I have been trying to work around with this, but doesn't seem to work.
Output:
.+++M OPICDHSBEI=SL=7= .59p707c5f.g 4 p LP PAB MM=COB0G
SD.S/A8O(=0= 307L8 2E6M0VuJnE = LR0C=D.G1=4D 26OV10=T. 6O0C0=mB0- Dn0R= .S8C4=1G52.B 11OK.p=P0 1=m .1 81 8. u9...
It is printing the 1st column of vertical characters.
Thank you in advance.

Respuesta aceptada

Star Strider
Star Strider el 5 de Ag. de 2020
Since ‘tran_models’ is an array, just use a loop:
for k = 1:size(tran_models,1)
fprintf(File,'%s\n', tran_models(k,:));
end
.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by