Product of Each Column - MATLAB Cody - MATLAB Central

Problem 44467. Product of Each Column

Difficulty:Rate

Given a matrix mat with n columns, return a row vector v of length n, where every element in v is the product of the n-th column.

You cannot use MATLAB Prod() function

Example:

Input: mat = [ 1,  2,  3,  4;
               5,  6,  7,  2;
               2,  3,  4,  5]
Output: v  = [10, 36, 84, 40]

Solution Stats

38.4% Correct | 61.6% Incorrect
Last Solution submitted on Mar 10, 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...
2
4
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 Solvers401

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page