Hi, I have two vectors vec1 and vec2 of the same length that I am plotting in one graph. I want a background color to show up where vec1 has a greater value than vec2. I tried doing this with patches but I can't get the indices right.
h=patch([xcolstart xcolend xcolend xcolstart],[0 0 5 5],'g'); set(h,'FaceAlpha',0.2); set(h,'EdgeColor','none');
Basically I need the indices of start and end points xcolstart and xcolend in sections where vec1>vec2. Is there an elegant way of doing this or is there another function besides patch that can do this more easily? Thank you
Best Answer