MATLAB: Assignment has more non-singleton rhs dimensions than non-singleton subscripts

MATLABMATLAB and Simulink Student Suite

Why is it that i only get this error when i change the 'threshold' value?. This simple code works at threshold = 10, 15 but not at 20 and upwards
threshold=20
>> for j = 1:8
index(:,j) = find(m3(:,j)> threshold,1,'first');
end
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
ver R2017a
m3 =
1.9283 1.9450 1.8450 1.9117 1.8267 1.7800 1.7300 1.6500
1.7000 1.7500 1.7600 1.7267 1.7567 1.6867 1.5750 1.5700
3.2850 3.2167 3.5567 170.7783 3.6817 2.8783 2.3567 2.8933
4.1533 4.0850 6.7800 125.9267 11.7533 3.7333 2.8467 3.9567
4.3467 4.1983 12.1450 74.5017 23.4100 4.1067 2.9967 4.2967
4.3133 4.4167 17.7867 48.0500 25.2150 4.2067 3.0300 4.4867
4.4483 4.6883 26.2933 40.0750 25.6083 4.5183 3.0883 4.7767
4.4367 4.8800 40.0967 54.6083 37.3933 4.1950 3.0583 4.8983
4.8717 5.4867 123.1400 167.3433 133.6517 4.8767 2.9367 5.4367
5.4050 6.4300 156.8017 190.4900 155.9600 5.8367 3.2883 6.0400
5.5067 7.5267 165.0300 175.6833 131.3150 6.5500 3.2617 6.1683
6.0717 10.3817 221.9350 210.7483 174.8317 8.9667 3.5867 7.0717
6.1900 14.3417 241.6683 230.6917 196.5917 31.2850 3.6567 7.2433
6.6583 18.6817 274.6233 255.6367 213.5483 211.5483 4.0033 7.6550
7.2333 23.6900 318.2817 310.2850 279.6983 358.9350 4.4667 8.2333
7.6033 28.1383 285.4750 288.9233 258.5100 300.9967 5.1283 8.7000
8.1467 32.0533 233.3800 233.2750 213.5283 227.3150 6.1450 9.2000
8.5733 37.2933 223.2350 224.1717 209.7650 224.5100 7.0267 9.5467
9.2917 42.7783 229.6567 232.5917 216.5983 238.5000 8.2250 10.2500
9.9783 48.6767 230.9417 232.8533 217.9100 239.2750 9.3400 10.7917
10.8833 55.5833 249.4667 245.8083 229.9550 245.5717 11.2050 11.3250
11.6817 60.9917 235.1217 232.5350 222.0117 229.7517 13.2700 11.7200
12.7867 68.6350 225.1800 222.6900 214.2433 210.1650 19.2317 12.5150
13.8733 75.5817 217.2300 215.0617 207.7950 191.1583 27.3650 13.1383
14.9400 82.5700 211.0117 208.0967 202.9450 176.3633 34.4550 13.6050
16.0583 88.6667 202.7317 198.7300 195.6950 157.8500 41.1767 14.2250
17.2600 97.5467 200.8317 193.6250 195.1967 151.1517 48.9000 14.8950
18.4367 107.9700 204.6350 194.7367 199.5433 143.8417 58.0883 15.5583
19.6050 121.2183 203.5750 192.5867 200.2433 132.7633 69.9783 16.2217
20.9767 137.3400 199.2517 192.3283 197.4683 115.5317 81.8250 16.9633
22.4517 159.3450 194.6333 185.3883 194.6383 87.6883 93.8633 17.7767
24.1017 169.5717 188.2683 176.8433 190.1533 60.1450 119.2767 18.5550

Best Answer

The last column has no entries greater than 18.55 so with threshold 20, the find will return empty.