Try and Catch Simple Example - MATLAB Cody - MATLAB Central

Problem 3107. Try and Catch Simple Example

Difficulty:Rate

Try and Catch Simple Example

Example

Vector x=[1 4 6 8 10];

Create a function using try and catch, if user asks index 0 or negative or more than the length, then display zero otherwise value of x.

Solution Stats

63.44% Correct | 36.56% Incorrect
Last Solution submitted on Dec 07, 2024

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
3
6

Problem Recent Solvers131

Suggested Problems

More from this Author70

Community Treasure Hunt

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

Start Hunting!