Replace Vector Elements - MATLAB Cody - MATLAB Central

Problem 710. Replace Vector Elements

Difficulty:Rate

Replace all elements in a vector which are equal to or smaller than zero with 0.1.

Example:

 A = [1 2 3 -1 0 2 -3 -80];

Answer:

 B = [1 2 3 0.1 0.1 2 0.1 0.1];

Solution Stats

56.17% Correct | 43.83% Incorrect
Last Solution submitted on Oct 31, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...
Dive Into Hands-On Learning at MATLAB EXPO 2025 – Register Now!
Get ready to roll up your sleeves at MATLAB EXPO 2025 –...
0

Problem Recent Solvers498

Suggested Problems

More from this Author11

Problem Tags

Community Treasure Hunt

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

Start Hunting!