Logical array indexing - part 1 - MATLAB Cody - MATLAB Central

Problem 43607. Logical array indexing - part 1

Difficulty:Rate

Given an array A of size p x q , return an array Y of the same size such that the following conditions are satisfied.

(1) The non-zero elements should be greater than a given value 'n' .

(2) These non-zero entries in Y should have the same values as their corresponding elements in A

For example: Given A = [3 4 5 6 2 4 5 6 3 6] and n = 4 , return Y = [0 0 5 6 0 0 5 6 0 6]

Solution Stats

73.13% Correct | 26.87% Incorrect
Last Solution submitted on Feb 07, 2025

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 Solvers44

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!