Change value in Matlab table in multiple columns
9 次查看(过去 30 天)
显示 更早的评论
I have a large table and want to change the values in specific columns (columns 16:41) to a different number. So for example if the number 3 is given in one of the 26 columns, this needs to be changed to 0, a number 2 to a 1 and a number 1 to a 2. I tried to do it with a loop but it didn't work and I can write a code for each of the 26 columns separately, but there must be an easier way. I also tried what I typed below where m is my dataset, but got an error 'incorrect use of '=' operator.'
(m{:,16:41} == 3) = 0;
Anyone who knows how to do this?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!