Cody

Problem 3108. Don't Try, give up and return NaN.

Created by Jan Orwat in Community

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

45.24% Correct | 54.76% Incorrect
Last solution submitted on Jan 24, 2019

Problem Comments

Recent Solvers25

Suggested Problems

More from this Author47

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!