Plot different colors

后端 未结 2 934
眼角桃花
眼角桃花 2021-01-28 08:39

Let\'s say W = [1 3 5; 2 1 5; 6 9 1] and K = [0.2, 0.5, 0.3] How can I plot all elements in k with the same color exept those elements that have

2条回答
  •  既然无缘
    2021-01-28 09:34

    If you plot point-by-point you can change the color correspondingly, for example something like this:

    for i = 1:size(W,2)
        if find(W>6)~=0
            plot(i,K(i),'xb');hold on
        else
            plot(i,K(i),'xr');hold on
        end
    end
    

    Since the information you gave is not enough, the code above needs to be modified according to W and K,....

提交回复
热议问题