How to write a multi line string?

19 次查看(过去 30 天)
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.

采纳的回答

Star Strider
Star Strider 2020-8-5
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
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Desktop 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by