Create array of all zeros
1 次查看(过去 30 天)
显示 更早的评论
I use "zeros" to create a matrix with all zeros.
but I want to create matrix with all 0.0000
is there any way for doing this?
c=zeros(10,1);
I would like to have all 0.0000
Thank you very much
0 个评论
采纳的回答
Azzi Abdelmalek
2016-6-13
编辑:Azzi Abdelmalek
2016-6-13
c=zeros(10,1);
c=arrayfun(@(x) sprintf('%.4f',x),c,'un',0)
%or
c=zeros(10,1);
sprintf('%.4f\n',c)
4 个评论
Azzi Abdelmalek
2016-6-13
@Maryam, If you don't want to print it, let it as it is, no one will see it!
更多回答(1 个)
Star Strider
2016-6-13
They all are. What you see depends on the display format you choose.
To see all the zeros, type:
format long g
in the Command Window or in your script.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!