Is it possible to create a numeric array with a mixture of empty cells and numbers?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hey. I want to create an array where some cells are empty and some have values.
For example, a 3x3 array :
16 22 NaN
NaN 2 1
9 19 NaN
Is this possible on MATLAB?
1 Kommentar
Stephen23
am 25 Jan. 2018
Note that "empty" and NaN are two totally different concepts in MATLAB, yet your question seems to confuse them. It is not possible to have empty elements in a numeric array, but it is certainly possible to have NaN values.
Antworten (1)
James Tursa
am 25 Jan. 2018
Bearbeitet: James Tursa
am 25 Jan. 2018
Well, you can do it directly pretty much as you typed it:
result = [16 22 NaN
NaN 2 1
9 19 NaN];
Note that every "spot" must have a value, even if it is NaN. The dimensions always have to be rectangular.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!