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.
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!