Custom Vector - make vector x to be [1,1,....]
古いコメントを表示
Hello Experts,
I want to create a vector x where all n elements are for example c.
I can do this by:
n=5;
x=zeros(1,n);
x(x==0) = 1;
But how to do this in more simple way.
Thanks a lot!
採用された回答
その他の回答 (1 件)
bym
2011 年 10 月 6 日
x = ones(1,5)
カテゴリ
ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!