Related Vectors - MATLAB Cody - MATLAB Central

Problem 1511. Related Vectors

Difficulty:Rate

I have two vectors A & B. If the values in vector A is zero then the corresponding value in vector B should be zero.

Example:

A=[1 2 3 0 4 4];

B=[4 5 2 1 0 2];

Output:

A=[1 2 3 0 4 4];

B=[4 5 2 0 0 2];

Since the value zero appears in vector A at index 4, the 4th index value in vector B should be set to zero.

Solution Stats

70.64% Correct | 29.36% Incorrect
Last Solution submitted on Apr 22, 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 Solvers206

Suggested Problems

More from this Author9

Problem Tags

Community Treasure Hunt

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

Start Hunting!