fprintf ¨ç¼Æ¥i±N¸ê®Æ¨Ì®æ¦¡«ü©w¦r¦ê¨Ó¼g¤J ASCII ÀɮסA¨ä¨Ï¥Î»yªk¦p¤U¡G
fprintf(fid, format, y) ¨ä¤¤ fid ¬O±ý¼g¤J¤§Àɮתº¿ëÃѽX¡]¥Ñ fopen ²£¥Í¡^¡Aformat ¬O®æ¦¡«ü©w¦r¦ê¡A¥Î¥H«ü©w¸ê®Æ¼g¦ÜÀɮתº®æ¦¡¡Ay «h¬O MATLAB ªº¸ê®ÆÅܼơC±`¥Îªº®æ¦¡«ü©w¦r¦ê¦³¤U¦C´XºØ¡G
- %e¡G¬ì¾Ç°O¸¹¡A§Y±N¼ÆȪí¥Ü¦¨ a¡Ñ10b ªº§Î¦¡
- %f¡G©T©wÄæ¼e¡]§t¾ã¼Æ»P¤p¼Æ³¡¥÷¡^ªºªí¥Üªk
- %g¡G¦Û°Ê¿ï¨ú %e ©Î %f
¨ä¥L¦UºØ®æ¦¡«ü©w¦r¦ê¥i¿é¤J help fprintf ¨Ó±o¨ì¸Ô²Óªº½u¤W»¡©ú¡C¨Ò¦p¡A±ý±N¤@¥¤è®Úªí¼g¤J squareRootTable.txt¡A¥i¿é¤J¦p¤U¡G
¦b¤W¨Ò¤¤¡A%2.0f ¦L¥XªºÁ`Äæ¼e¬° 2¡A¥B¤£±a¤p¼Æ¡A¦Ó %10.6f ¦L¥XªºÁ`Äæ¼e¬° 10¡A¥]§tÄæ¼e¬° 6 ªº¤p¼Æ³¡¥÷¡C¡]ŪªÌ¥i¥Ñ¶}±Òªº squareRootTable.txt ¨ÓÅçÃÒ¤Wzªº¦C¦L®æ¦¡¡C¡^
sprintf ¨ç¼Æ©M fprintf ¨ç¼Æªº¥\¯à«ÜÃþ¦ü¡A°ß¤@¤£¦Pªº¬O¡Asprintf ±N¸ê®Æ¥H¦r¦ê§Î¦¡¶Ç¦^¡A¦Ó¤£¬Oª½±µ¼g¤JÀɮסC¨Ò¦p¡G
>> str = sprintf('log(%f) = %e\n', 2, log(2)) str = log(2.000000) = 6.931472e-001 ¦b¬Y¨ÇÀ³¥Î¤W¡A¥i¯à»Ýn¥Î¨ì¼È¦s¥Ø¿ý¤Î¼È¦sÀɮסC±ý¨ú¥Î¨t²Îªº¼È¦s¥Ø¿ý¡A¥i¥Î tempdir¡A¦p¤U¡G
>> directory = tempdir directory = C:\Users\ROGERJ~1\AppData\Local\Temp\ ±ý¶}±Ò¤@¼È¦sÀɮסA¥i¥Î tempname¡A¦p¤U¡G
>> filename = tempname filename = C:\Users\ROGERJ~1\AppData\Local\Temp\tpd8a0f416_427f_46de_9e3e_c8baf771a03f
¥H¤Uªº½d¨Ò¡A´N¬O§Q¥Î tempname ²£¥Í¤@ӼȦsªº HTML ÀɮסAµM«á¦A±N¦¹ÀÉ®×Åã¥Ü¦bÂsÄý¾¹¡C
²£¥Í¤§ºô¶¦p¤U¡G
MATLABµ{¦¡³]p¡G¤Jªù½g