Clear Filters
Clear Filters

Can I make this line of code smaller?

1 view (last 30 days)
if isempty(XBest) XBest = 1e8; end

Accepted Answer

Askic V
Askic V on 3 Mar 2023
XBest=[2, 3, 4];
XBest(isempty(XBest)) = 1e8;
XBest
XBest = 1×3
2 3 4
XAest = [];
XAest(isempty(XAest)) = 1e8;
XAest
XAest = 100000000

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!