This is another version of problem 3107.

The goal is to return values of an array A given index N, but return NaN for incorrect index.

Example:

    >> A = 1:5;
    >> N = [-1 2 6];
    >> values = giveup(A, N)
    values =
       NaN     2     NaN

Solution Stats

143 Solutions

42 Solvers

Last Solution submitted on May 28, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers42

Suggested Problems

More from this Author40

Problem Tags

Community Treasure Hunt

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

Start Hunting!