Counting the number of increments in a vector

3 Ansichten (letzte 30 Tage)
Scott Banks
Scott Banks am 5 Aug. 2025
Kommentiert: Torsten am 5 Aug. 2025
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

Akzeptierte Antwort

Torsten
Torsten am 5 Aug. 2025
Verschoben: Torsten am 5 Aug. 2025
x = 0:0.1:7;
numel(x(x<=3))
ans = 31

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices 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