how to extract special elements from a matrix

Hi, I have a matrix, let say M1 = [1,0,0,8;0,0,15,0;0,0,0,0;7,0,0,0].
How can I extract only non-zero elements to another matrix M2.
Thank you.

カテゴリ

ヘルプ センター および File ExchangeAerospace Blockset についてさらに検索

質問済み:

Ali
2012 年 10 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by