I'm having trouble sorting all the integers into the two separate arrays. I can only recall the last positive and last negative numbers in the arrays.
This is what i have so far.
H = randi([-20,20],1,16);for array = H; if array<0 H1 = array; elseif array>=0 H2 = array; end endH1H2
when the program runs this is the output.
H1 = -3H2 = 14
I'm fairly new to the matlab program so any help is appreciated.
Best Answer