Replace Element of an Array with another Array

Hello, I have an initiator matrix
In=[1 0 1;0 0 0;1 0 1]; % Initiator Matrix
and a zero matrix
zero=zeros(3);
  1. Step 1I need to find all elements in "In" that are equal to 1 and insert "In" in that elements place, all elements with "0" insert the matrix "zero" in that place. This is a cellarray.
  2. Step 2I need to convert to the cellarray to a matrix. I think I do that with cell2mat() command right?
Thanks for your help.
Russell

1 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 15 日
What should be the result?

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeOperators and Elementary Operations についてさらに検索

質問済み:

2013 年 5 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by