How to change nonzero values to 1 within a table?

7 Ansichten (letzte 30 Tage)
A DDD
A DDD am 19 Dez. 2019
Kommentiert: Ridwan Alam am 20 Dez. 2019
How to change nonzero values to '1' within a table? for all columns at once.

Akzeptierte Antwort

Ridwan Alam
Ridwan Alam am 19 Dez. 2019
tempTable = table2array(myTable);
tempTable(tempTable~=0)=1;
myTable = array2table(tempTable);

Weitere Antworten (0)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by