cell array elements comparision

4 ビュー (過去 30 日間)
lucksBi
lucksBi 2017 年 4 月 13 日
コメント済み: lucksBi 2017 年 4 月 13 日
i hv cell array whose elements hv values like this:-
a{1,1}=1
a{1,2}=-1
a{2,1}=-1
a{2,2}=1
& many more rows like this
i want to check if a a{1,1} & a{1,2} both hv value 1 then put in a new array. if a{1,1 }has 1 & a{1,2} -1 then put in another array & similarly any other conditions like this. how can i solve this problem?Any help ll be greatly appreciated.

回答 (1 件)

Philip G
Philip G 2017 年 4 月 13 日
Hey lucksBi again ;)
These are very basic operations you are asking - maybe consult the documentation for basic handling of cell arrays. For your specific question one way would be:
if a{1,1}==a{1,2} & a{1,1}==1
% put them in new array
elseif a{1,1}==a{1,2} & a{1,1}==-1
% put them in other array
end
  1 件のコメント
lucksBi
lucksBi 2017 年 4 月 13 日
hey ;) Thanks for your answer.
actually i have near 2000 elements of cell array. Is there any way to do it without specifying each element separately?

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

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by