How to write a multi line string?

7 ビュー (過去 30 日間)
Jay Vaidya
Jay Vaidya 2020 年 8 月 5 日
回答済み: Star Strider 2020 年 8 月 5 日
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 Center および File ExchangeProgramming についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by