Replace zeros with a number
显示 更早的评论
I am trying to create an upper bound condition for a portfolio weighting problem to equal 2%. How can I replace the zeros in the following matrix to equal 0.02?
UB = zeros(N,1)
Thanks
回答(1 个)
madhan ravi
2019-3-28
UB(UB==0) = 0.02;
% why not
UB = 0.02*ones(N,1) % in the first place?
类别
在 帮助中心 和 File Exchange 中查找有关 Portfolio Optimization and Asset Allocation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!