Plot and color curves depending on the condition
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
CheshireM
el 29 de Sept. de 2021
Comentada: CheshireM
el 30 de Sept. de 2021
I have a cell array Ready, 4x500.
Example, how it looks.
Each cell is a double array, similar structure.
Example of Ready{1,2}.
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).
Could you please help me with this?
Thank you very much!
0 comentarios
Respuesta aceptada
Kevin Holly
el 29 de Sept. de 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.
for i = 1:size(Ready,1)
figure
title(['Plot for Row ' num2str(i)])
xlabel('X Label')
ylabel('Y Label')
for ii=1:size(Ready,2)
m = Ready{i,ii};
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
8 comentarios
Kevin Holly
el 30 de Sept. de 2021
@CheshireM No problem! If you can, I would appreciate it if you would accept this answer.
Más respuestas (0)
Ver también
Categorías
Más información sobre Subplots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!