Text header in file
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
Hi everybody,
I wanted to write a info header in a txt file from Matlab. I wanted to include author information, date, and some details of the file, something like this
/------------------------------------------------------- /Journal File for Gambit 2.4.6, Database 2.4.4, intx86 SP2007051421 /Identifier: Geometry2 /Ph.D Project. 'Aerodynamic Optimization of ICE2 High-speed Train Nose Using a Genetic Algorithm and Metamodels' /Miguel Martin (<mailto:lehouth@upm.es lehouth@upm.es>) Universidad Politecnica de Madrid, Spain /Date: 16/03/2012 /-------------------------------------
The point is that I wanted all to be included in some kind of box made of /----- ... ---/, so at the beginning of each row there is a /, and at the end of them once again, but this last character should appear not just after the text but in the same column as the largest string. My first idea was to create long strings with spaces and ending with a / character, but this is not cool at all, is there any way to do it in a smarter way?
(this is what i did
infoTitle = '/Journal File for Gambit 2.4.6, Database 2.4.4, intx86 SP2007051421 /'; cs = ''''; infoProject = ['/Ph.D Project. ' cs 'Aerodynamic Optimization of ICE2 High-speed Train Nose Using a Genetic Algorithm and Metamodels' cs]; fprintf(fid, '%s \n%s, infoTitle)
Thanks in advance
L3munoz
1 个评论
Jan
2012-3-16
Please format the code and the text as explained in the "Markup help" link on this page.
回答(0 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!