if statements

10 次查看(过去 30 天)
bobby
bobby 2011-12-6
I have a set of data with 996 columns and 998 rows. Could I construct if statements so that each column returns 0 if all values are positive or all values are negative, and 1 if there is some combination of the two?

采纳的回答

the cyclist
the cyclist 2011-12-6
A = rand(998,996); % Use your data in place of A
B = not(all(A>0) | all(A<0));
  1 个评论
bobby
bobby 2011-12-6
thank you so much, what if I wanted to differentiate the values that return one now, like return +1 if the very first value is positive and negative 1 if they first value is negative?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by