what can we use when we dont have value in a matrix instead of 0?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
arian hoseini
am 25 Jun. 2022
Kommentiert: Cris LaPierre
am 25 Jun. 2022
i have a matrix of my data and i dont want to put 0 for the items that i dont have ...is there any other way?
2 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 25 Jun. 2022
use nan?
data = rand(3);
data(2,3) = nan
You could also use missing, especially if you are usure of the data type. The result is the same as nan for doubles.
data(3,2) = missing
c = ["a","b","c"];
c(1) = missing
5 Kommentare
Cris LaPierre
am 25 Jun. 2022
Sorry, but I don't see how Z relates to Data.
Also, it appears your outer for loop in Zone 1 is unnecessary (for k = 1 : 2). It runs the same code without any changes. You'd get the same results without it.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!