check if an array is equispaced
Ältere Kommentare anzeigen
I am given a vector of numbers and I have to check if this vector has its samples equispaced or not. How can I do it without using fors?
Akzeptierte Antwort
Weitere Antworten (1)
>> v = [1,2,3,4,5,6,7];
>> x = ~any(diff(v,2))
x = 1
>> v = [1,2,4,4.5,7];
>> x = ~any(diff(v,2))
x = 0
1 Kommentar
Mireia Boneta Camí
am 12 Okt. 2020
Kategorien
Mehr zu Cell Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!