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?

 Réponse acceptée

the cyclist
the cyclist le 6 Déc 2011

0 votes

A = rand(998,996); % Use your data in place of A
B = not(all(A>0) | all(A<0));

1 commentaire

bobby
bobby le 6 Déc 2011
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?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by