how to add nan values to existing array?

9 vues (au cours des 30 derniers jours)
Suresh R
Suresh R le 3 Nov 2021
Commenté : the cyclist le 3 Nov 2021
how to add nan values to existing array? i have 1X5 array.i want to change size to 10x5.
  2 commentaires
Johan
Johan le 3 Nov 2021
You can try this
A = rand(1,5)
A = 1×5
0.5817 0.9565 0.1770 0.5972 0.9275
A = [A;NaN*(ones(9,5))]
A = 10×5
0.5817 0.9565 0.1770 0.5972 0.9275 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
the cyclist
the cyclist le 3 Nov 2021
You can do
nan(9,5)
rather than
NaN*(ones(9,5))

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by