How to change nonzero values to 1 within a table?

18 vues (au cours des 30 derniers jours)
A DDD
A DDD le 19 Déc 2019
Commenté : Ridwan Alam le 20 Déc 2019
How to change nonzero values to '1' within a table? for all columns at once.

Réponse acceptée

Ridwan Alam
Ridwan Alam le 19 Déc 2019
tempTable = table2array(myTable);
tempTable(tempTable~=0)=1;
myTable = array2table(tempTable);

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by