Average valid values of arrays - MATLAB Cody - MATLAB Central

Problem 42351. Average valid values of arrays

Difficulty:Rate

Given a 1D array (column or row vector), compute the average of valid values. Valid values are defined via two thresholds: minValue and maxValue. Example:

x = [-1 -5.4 14.6 20.9 25.5 -22.4 18 15.5 -33.7 -38.1];
minValue = -10;
maxValue = 10;
y = validAverage(x, minValue, maxValue) = -3.2

To keep it simple, let's assume minValue and maxValue are within the array range.

Solution Stats

55.83% Correct | 44.17% Incorrect
Last Solution submitted on Nov 30, 2024

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers59

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!