フィルターのクリア

How do I get rid of positive or negative values in a cell array?

3 ビュー (過去 30 日間)
Yerzhigit Bapin
Yerzhigit Bapin 2017 年 7 月 14 日
コメント済み: Anthony Castellano 2018 年 6 月 28 日
How do I create a cell array that consists of only positive or negative values of another cell array in a for loop?
For example, C is a cell 1x24 cell array consisting of 16x7 matrices. First, I need to get rid of the positive numbers in those matrices, second I need to turn the negative values into positives.
I hope I was clear.
Thanks.
  2 件のコメント
KSSV
KSSV 2017 年 7 月 14 日
You want to get rid? That means you want to replace them or remove them? If you remove them then you will not get a matrix, the result would be a vector..what you want ?
Yerzhigit Bapin
Yerzhigit Bapin 2017 年 7 月 17 日
I want to replace them with zeros.

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

採用された回答

Jan
Jan 2017 年 7 月 17 日
編集済み: Jan 2017 年 7 月 17 日
for iC = 1:numel(C)
M = C{iC};
M(M > 0) = 0;
C{iC} = -M;
end
  1 件のコメント
Anthony Castellano
Anthony Castellano 2018 年 6 月 28 日
There's no way to do it without that for loop, huh?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by