# Plot and color curves depending on the condition

5 views (last 30 days)
CheshireM on 29 Sep 2021
Commented: CheshireM on 30 Sep 2021
I have a cell array Ready, 4x500.
Example, how it looks. Each cell is a double array, similar structure. I want to make a plot for every 5th row in Ready as x-axis, (6,7,8,9) and the sum of 3d row as y-axis(2.4443, 2.4443, 2.4443 in the example).
So, as a result I want to get 4 plots (for every row of cell array Ready), every cell - different color (black, read or green), depending on 7th row (001 - black, 111 - green, 000 - red).
Thank you very much!

Kevin Holly on 29 Sep 2021
I am unsure what you mean by "he sum of 3d row as y-axis(2.4443, 2.4443, 2.4443 in the example)."
For now I am plotting the 5th row against the 3rd row. Please see below.
figure
title(['Plot for Row ' num2str(i)])
xlabel('X Label')
ylabel('Y Label')
if [m(7,2) m(7,3) m(7,4)] == [0 0 1]
plot(m(5,:),m(3,:),'color','k')
end
if [m(7,2) m(7,3) m(7,4)] == [1 1 1]
plot(m(5,:),m(3,:),'color','g')
end
if [m(7,2) m(7,3) m(7,4)] == [0 0 0]
plot(m(5,:),m(3,:),'color','r')
end
hold on
end
hold off
end
CheshireM on 30 Sep 2021
Of course! Thank you!

R2021a

### Community Treasure Hunt

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

Start Hunting!