MATLAB Answers

How to change nonzero values to 1 within a table?

2 views (last 30 days)
How to change nonzero values to '1' within a table? for all columns at once.

  0 Comments

Sign in to comment.

Accepted Answer

Ridwan Alam
Ridwan Alam on 19 Dec 2019
tempTable = table2array(myTable);
tempTable(tempTable~=0)=1;
myTable = array2table(tempTable);

More Answers (0)

Sign in to answer this question.