フィルターのクリア

take rows from one matrix and put in output matrix

1 回表示 (過去 30 日間)
Bennie
Bennie 2012 年 2 月 15 日
I am trying take the values from matrix a and place them in Matrix B as the rules are iterated. % a value of 1 reperesnts a car in the cell and 0 represents %and empty space% a=zeros(2,100); newa=zeros(2,100);
g=1; max=100; a(1,50)=1; a(2,30)=1; B(1,:);(2,:)=a; B=a;
while (g<max), for i=2:99 if a(ij+1)==0, newa(ij+1)=1 else newa(ij)=0;
end end g=g+1; a=newa; b=newb; B(g,:)=a;
end spy(B),
  1 件のコメント
Image Analyst
Image Analyst 2012 年 2 月 15 日
Don't override max() (use it as your own local variable) - it's a built-in function.

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

採用された回答

Image Analyst
Image Analyst 2012 年 2 月 15 日
If B and A are the same number of rows
B(:, columnNumberB) = A(:, ColumnNumberA);
This replaces the entire column "columnNumberB" in array B with what's in "columNumberA" of array A.
I don't know what "as the rules are iterated" means

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by