MATLAB: How to change nonzero values to 1 within a table

table nonzero values 1 table

How to change nonzero values to '1' within a table? for all columns at once.

Best Answer

tempTable = table2array(myTable);
tempTable(tempTable~=0)=1;
myTable = array2table(tempTable);