How to write a multi line string?

20 views (last 30 days)
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.

Accepted Answer

Star Strider
Star Strider on 5 Aug 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
.

More Answers (0)

Categories

Find more on Desktop in Help Center and File Exchange

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!