没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
MATLAB
Guidelines 2.0
Richard Johnson
MATLAB Style Guidelines
2
Version 2, March 2014
Copyright © 2002 - 2014 Datatool
All rights reserved.
ISBN
Library of Congress Control Number
3
Contents
Introduction 5
Naming Conventions 7
Variables 7
Constants 13
Structures 14
Functions 15
General 19
Statements 21
Variables and constants 21
Globals 21
Loops 22
Conditionals 23
General 24
Layout, Comments and Documentation 29
Layout 29
White Space 30
Comments 32
Files and Organization 37
M Files 37
Input and Output 39
Toolboxes 40
Style quotes 41
References 43
MATLAB Style Guidelines
4
5
Introduction
Advice on writing MATLAB code usually addresses efficiency
concerns, with recommendations such as “Don’t use loops.” This
document is different. Its concerns are correctness, clarity and
generality. The goal of these guidelines is to help produce code
that is more likely to be correct, understandable, sharable and
maintainable.
Some ways of coding are better than others. It’s as simple as that.
Coding conventions add value by helping to make mistakes
obvious. As Brian Kernighan writes, “Well-written programs are
better than badly-written ones -- they have fewer errors and are
easier to debug and to modify -- so it is important to think about
style from the beginning.”
When people look at your code, will they see what you are
doing? The spirit of this book can be pithily expressed as “Avoid
write-only code.”
This document lists MATLAB coding recommendations
consistent with best practices in the software development
community. These guidelines are generally the same as those for
C, C++ and Java, with modifications for MATLAB features and
history. The recommendations are based on guidelines for other
languages collected from a number of sources and on personal
experience. These guidelines are written with MATLAB in mind,
and they should also be useful for related languages such as
Octave, Scilab and O-Matrix.
Issues of style are becoming increasingly important as the
MATLAB language changes and its use becomes more
widespread. In the early versions, all variables were double
precision matrices; now many data types are available. Usage
has grown from small scale prototype code to large and complex
剩余42页未读,继续阅读
资源评论
- zhanghs20102019-12-31非常不错,对于想规范matlab变成的人,可以下载来学习一下。
JoeyZhong
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功