How to change nonzero values to 1 within a table?

11 次查看(过去 30 天)
How to change nonzero values to '1' within a table? for all columns at once.

采纳的回答

Ridwan Alam
Ridwan Alam 2019-12-19
tempTable = table2array(myTable);
tempTable(tempTable~=0)=1;
myTable = array2table(tempTable);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by