haibaraxx的个人博客分享 http://blog.sciencenet.cn/u/haibaraxx

博文

Matlab: create arrays of all zeros and ones

已有 1886 次阅读 2016-8-20 04:22 |个人分类:Matlab|系统分类:科研笔记| and, arrays, zeros, ones

Syntax: zeros_square=zeros(3);

Output:  0 0 0

             0 0 0

             0 0 0


Syntax: zeros_2by3=zeros(2,3);

Output:  0 0 0

             0 0 0


Syntax: ones_square=ones(2);

Output: 1 1

            1 1


Syntax: ones_3by5=ones(3,5);

Output: 1 1 1 1 1

            1 1 1 1 1

            1 1 1 1 1


Syntax: threes_2by3=3*ones(2,3);

Output: 3 3 3

            3 3 3



https://blog.sciencenet.cn/blog-3031432-997510.html

上一篇:Matlab: if statement
下一篇:Matlab online version
收藏 IP: 134.1.1.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-10-20 13:26

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部