20060315-Quick tip: Use the functions true and false
来源:互联网 发布:mac下python开发工具 编辑:程序博客网 时间:2024/05/19 16:35
原文:http://blogs.mathworks.com/steve/2006/03/15/quick-tip-use-the-functions-true-and-false/
I saw some code recently that looked something like this:
B = zeros(size(A));B = logical(B);
The intent of the code was to initialize an all-zero binary image with the same size asA. Note, however, that the output of the zeros function in the first line is a double-precision array, which requireseight bytes per element. Logical arrays in MATLAB, on the other hand, useonly one byte per element. It's quicker and more memory efficient to initialize B using thefalse function.
The functions true and false are most often seen without input arguments, in which case they return a scalar logical 1 or a scalar logical 0, respectively. But they also support an optional size input. So the following code works just as well for initializing the binary image:
B = false(size(A));
- 20060315-Quick tip: Use the functions true and false
- True And False
- The use of functions
- The use of functions
- True Positive,True Negative,False Positive and False Negative
- True Positive,True Negative,False Positive and False Negative
- The False Use of SVN
- request.getSession(true) and request.getSession(false)
- scheme基本概念之true and false
- True/False
- JavaWeb(6)-Maven Setup and Quick Use
- Quick Tip: Don’t Forget the Viewport Meta Tag
- True or False? and WHY??? Java HashSet Contains
- Windows Phone 7 Quick Tip: How to use Bing Maps in XNA games
- URLRewriteFilter usage - use-query-string="true" and use-context="true"
- BOOL,TRUE,FALSE 和 bool ,true, false
- true false 与TRUE FALSE 的区别
- FALSE/TRUE与false/true的区别
- 给学习java web新手们的建议和推荐一些书籍
- 获取/设置IFRAME内对象元素的几种JS方法
- C++ 笔记 (2)
- PLSQL Developer (win7) 64位操作系统登录
- 简单的CardLayout布局案例
- 20060315-Quick tip: Use the functions true and false
- JQuery EasyUI 打开一个弹出窗口
- Android SDK 目录和作用的分析详解
- 修改document.domain的注意事项
- 黑马程序员_java的集合三TreeSet_09
- Hibernate缓存
- 读取jpeg文件的量化表,霍夫曼表等信息的工具
- 网站流量统计之PV和UV
- [转] C++ 中的智能指针