Create array with same number
显示 更早的评论
I have this command z=ones(length(x),1) If I want to change (ones) with 2 or 3 what I should do?
采纳的回答
更多回答(2 个)
José-Luis
2017-8-10
twos = 2.* ones(length(x),1)
3 个评论
Fadal Sasse
2017-8-10
José-Luis
2017-8-10
Please accept the answer that best solves your problem.
PY SUN
2018-9-14
Thanks
Drue
2023-2-22
To create arrays with the same number I'd personally just set a variable and put it in the linspace function
x = 3
poof = input('how many columns of this number do you want?')
linspace(x,x,poof)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!