I wrote a code to extract from a vector to another vector only numbers less than 10 and displayed the output to see the process a=[2; 8; 3; 30; 4; 50; 100; 200; 4; 80; 500] :
function b=clasify_decimels(a)b=zeros(11,1);for i=1:size(a,1) if (a(i)<10) b=a(i); disp(b) endend
The display is fine, it does what it should do:
>> clasify_decimels(a) 2 8 3 4 4
Yet it does not store the output in vector b that I have defined. Why is that?
Best Answer