representation of positive and negative number to binary 1 and 0 in matlab
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
- I have a column which has negative and positive values say
- volts = -5.2 -5.2 8.4 8.4 8.4 8.4 -5.2 5.2
- i have to represent positive number as 1 and negative number as 0. How should I write a statement for it in matlab??
0 Commenti
Risposte (1)
James Tursa
il 18 Ott 2018
Modificato: James Tursa
il 18 Ott 2018
result = volts > 0;
This will give you a logical result. If you need the result to be double, then simply
result = double(volts > 0);
You didn't specify what you wanted to happen to 0.
2 Commenti
Vedere anche
Categorie
Scopri di più su Debugging and Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!