iMATLAB
2008-10-13, 16:31
MATLAB 编程风格指南
Richard Johnson
Version 1.5,Oct. 2002
版权; Datatool 所有
翻译:Genial @ USTC
“Language is like a cracked kettle on which we beat tuned to dance to, while all
the time we long to move the stars to pity.”
- Gustave Flaubert, in Madame Bovary
目 录:
简介---------------------------------------------------------------------------------------------2
命名规则---------------------------------------------------------------------------------------2
变 量---------------------------------------------------------------------------------------2
常 数---------------------------------------------------------------------------------------4
结构体---------------------------------------------------------------------------------------5
函 数---------------------------------------------------------------------------------------5
概 要(General)------------------------------------------------------------------------7
文件与结构-------------------------------------------------------------------------------------7
M文件--------------------------------------------------------------------------------------7
输入输出-----------------------------------------------------------------------------------8
基本语句(Statements)---------------------------------------------------------------------9
变 量----------------------------------------------------------------------------------------9
循环语句----------------------------------------------------------------------------------10
条件语句----------------------------------------------------------------------------------10
小结----------------------------------------------------------------------------------------11
布局、注释与文档---------------------------------------------------------------------------13
排版(Layout)--------------------------------------------------------------------------13
空白空格(White Space)-------------------------------------------------------------14
注释-----------------------------------------------------------------------------------------15
文档-----------------------------------------------------------------------------------------16
参考文献----------------------------------------------------------------------------------------17
MATLAB Programming Style Guidelines
Richard Johnson
Version 1.5 October 2002
Copyright © 2002 Datatool
“Language is like a cracked kettle on which we beat tunes to dance to, while all the time
we long to move the stars to pity.” Gustave Flaubert, in Madame Bovary
Table of Contents
Introduction..............................................................................................................................................2
Naming Conventions .............................................................................................................................2
Variables..............................................................................................................................................2
Constants.............................................................................................................................................4
Structures ............................................................................................................................................4
Functions .............................................................................................................................................4
General ................................................................................................................................................6
Files and Organization...........................................................................................................................6
M Files..................................................................................................................................................6
Input and Output.................................................................................................................................7
Statements ..............................................................................................................................................7
Variables..............................................................................................................................................7
Loops....................................................................................................................................................8
Conditionals.........................................................................................................................................8
General ................................................................................................................................................9
Layout, Comments and Documentation ...........................................................................................10
Layout ................................................................................................................................................10
White Space......................................................................................................................................11
Comments .........................................................................................................................................12
Documentation..................................................................................................................................13
References ............................................................................................................................................13
Richard Johnson
Version 1.5,Oct. 2002
版权; Datatool 所有
翻译:Genial @ USTC
“Language is like a cracked kettle on which we beat tuned to dance to, while all
the time we long to move the stars to pity.”
- Gustave Flaubert, in Madame Bovary
目 录:
简介---------------------------------------------------------------------------------------------2
命名规则---------------------------------------------------------------------------------------2
变 量---------------------------------------------------------------------------------------2
常 数---------------------------------------------------------------------------------------4
结构体---------------------------------------------------------------------------------------5
函 数---------------------------------------------------------------------------------------5
概 要(General)------------------------------------------------------------------------7
文件与结构-------------------------------------------------------------------------------------7
M文件--------------------------------------------------------------------------------------7
输入输出-----------------------------------------------------------------------------------8
基本语句(Statements)---------------------------------------------------------------------9
变 量----------------------------------------------------------------------------------------9
循环语句----------------------------------------------------------------------------------10
条件语句----------------------------------------------------------------------------------10
小结----------------------------------------------------------------------------------------11
布局、注释与文档---------------------------------------------------------------------------13
排版(Layout)--------------------------------------------------------------------------13
空白空格(White Space)-------------------------------------------------------------14
注释-----------------------------------------------------------------------------------------15
文档-----------------------------------------------------------------------------------------16
参考文献----------------------------------------------------------------------------------------17
MATLAB Programming Style Guidelines
Richard Johnson
Version 1.5 October 2002
Copyright © 2002 Datatool
“Language is like a cracked kettle on which we beat tunes to dance to, while all the time
we long to move the stars to pity.” Gustave Flaubert, in Madame Bovary
Table of Contents
Introduction..............................................................................................................................................2
Naming Conventions .............................................................................................................................2
Variables..............................................................................................................................................2
Constants.............................................................................................................................................4
Structures ............................................................................................................................................4
Functions .............................................................................................................................................4
General ................................................................................................................................................6
Files and Organization...........................................................................................................................6
M Files..................................................................................................................................................6
Input and Output.................................................................................................................................7
Statements ..............................................................................................................................................7
Variables..............................................................................................................................................7
Loops....................................................................................................................................................8
Conditionals.........................................................................................................................................8
General ................................................................................................................................................9
Layout, Comments and Documentation ...........................................................................................10
Layout ................................................................................................................................................10
White Space......................................................................................................................................11
Comments .........................................................................................................................................12
Documentation..................................................................................................................................13
References ............................................................................................................................................13