How to skip the legends for some series of data that's actually Null after some Calculation?
이전 댓글 표시
Hello, everyone. Here is the problem I am facing. Say I have 3 series of data, but some of the series could be of length 0. As I plotted them all on the same figure, I want to legend them correctly, how should I do that more compactly? Below is what I got ( notice the data are all in the structure Performance)
if cellfun('isempty', Performance.Apple)
legend('Orange', 'Banana');
elseif cellfun('isempty', Performance.Orange)
legend('Banana', 'Orange');
elseif cellfun('isempty', Performance.Banana)
legend('Apple', 'Orange');
elseif cellfun('isempty', Performance.Apple) & cellfun('isempty', Performance.Orange)
legend('Banana');
elseif cellfun('isempty', Performance.Apple) & cellfun('isempty', Performance.Banana)
legend('Orange');
elseif cellfun('isempty', Performance.Orange) & cellfun('isempty', Performance.Banana)
legend('Apple');
end
So you get what I'm trying to do, right? I know there must be a trick to do these smartly, please help me.
답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!