Counting the number of increments in a vector

3 visualizzazioni (ultimi 30 giorni)
Hi guys,
I have vector x that goes between 0 and 7, with an increment of 0.1.
x = 0:0.1:7
I want to be able to know how many increments I have at say when x = 3, The answer is 31, but could I make use of any function in MATLAB to calculate this?
Many thanks,
Scott

Risposta accettata

Torsten
Torsten il 5 Ago 2025
Spostato: Torsten il 5 Ago 2025
x = 0:0.1:7;
numel(x(x<=3))
ans = 31

Più risposte (0)

Categorie

Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by