# findout missing values in between a contenous matrix

1 Ansicht (letzte 30 Tage)
navan am 14 Mai 2015
Beantwortet: Geoff Hayes am 17 Mai 2015
i have a contenous matrix from one to 20 with some vlues missed in. that is A=[1,2,3,4,7,8,11,14,16,19,20], i would like to get the missing values in between the matrix. The answer i expect is that
Missedvalues= [5,6,9,10,12,13,15,17,18]
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Geoff Hayes am 17 Mai 2015
navan - if you are just trying to find the missing elements of A if 1 is the minimum value and 20 is the maximum value, then you could do something like
A = [1,2,3,4,7,8,11,14,16,19,20];
minVal = min(A);
maxVal = max(A);
missedValues = setdiff(minVal:maxVal,A);
We use the setdiff function to determine which elements that are in the array defined by minVal:maxVal are not in A.
Try the above and see what happens!
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### 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!

Translated by