ゼロでない要素が一番多い行を探そう - MATLAB Cody - MATLAB Central

Problem 44408. ゼロでない要素が一番多い行を探そう

Difficulty:Rate

行列 a が与えられたとき、行列 a の中で一番ゼロの要素が少ない行のインデクス r を返す関数を作成しましょう。このとき、行列 a には一つだけしかこの条件に当てはまる行がないと仮定します。

例:

 入力として、行列  
 a = [ 1 2 0 0 0
       0 0 5 0 0 
       2 7 0 0 0
       0 6 9 3 3 ]
 が与えられたとき、出力 r は 4 を返します。

Solution Stats

47.87% Correct | 52.13% Incorrect
Last Solution submitted on Apr 27, 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 Solvers326

Suggested Problems

More from this Author12

Community Treasure Hunt

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

Start Hunting!
Go to top of page