Can I make this line of code smaller?

1 visualizzazione (ultimi 30 giorni)
Ishan Gawai
Ishan Gawai il 3 Mar 2023
Risposto: Askic V il 3 Mar 2023
if isempty(XBest) XBest = 1e8; end

Risposta accettata

Askic V
Askic V il 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

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by