フィルターのクリア

Using 3d matrix inmatlab

1 回表示 (過去 30 日間)
jana
jana 2013 年 5 月 29 日
A(:,:,1) =
1 1 0
0 1 1
1 1 1
A(:,:,2) =
1 0 0
0 0 1
0 0 1
I used [r,c,v] = ind2sub(size(A),find(A == 1)); to find r,c,v in matrix A that has a value 1. But I want to place a condition that while A == 1 then I(r,c) = v
for example I(1,1) = {1,2} since for v=1,2 A takes a value 1. Please help me out with a code.

採用された回答

Matt J
Matt J 2013 年 5 月 29 日
編集済み: Matt J 2013 年 5 月 29 日
[m,n,p]=size(A);
s=reshape(1:p,1,1,p);
A=bsxfun(@times,A,s);
  4 件のコメント
jana
jana 2013 年 5 月 29 日
l=cellfun(@(c) nonzeros(c).',l,'uni',0); it shows an error message : Input # 2 expected to be a cell array, was double instead.
jana
jana 2013 年 5 月 29 日
Navermind I fixed it. Thankyou!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by