How can I sort plot points based on a corresponding vector

1 view (last 30 days)
I have a huge data file that I need to sort into two groups. The vector is a list of temperatures of a greenhouse, and each value in the vector has a corresponding value in a second vector that has a 1 or 0 next to it (based on whether the vector was open or closed). I want to sort out these two values and plot them separately. How do I get matlab to do this?

Answers (1)

Walter Roberson
Walter Roberson on 19 Oct 2015
idx = logical(OpenClose;
plot(Temperatures(idx), 'b');
hold on
plot(Temperatures(~idx), 'k');
hold off

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!