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일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Entering Commands에 대해 자세히 알아보기

제품

태그

질문:

2011년 12월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by