Filter löschen
Filter löschen

Can I make this line of code smaller?

1 Ansicht (letzte 30 Tage)
Ishan Gawai
Ishan Gawai am 3 Mär. 2023
Beantwortet: Askic V am 3 Mär. 2023
if isempty(XBest) XBest = 1e8; end

Akzeptierte Antwort

Askic V
Askic V am 3 Mär. 2023
XBest=[2, 3, 4];
XBest(isempty(XBest)) = 1e8;
XBest
XBest = 1×3
2 3 4
XAest = [];
XAest(isempty(XAest)) = 1e8;
XAest
XAest = 100000000

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by