Won't update the second graph
이전 댓글 표시
b1 = a1(a1 ~= 0);
b2 = a2(a2 ~= 0);
b3 = a3(a3 ~= 0);
b4 = a4(a4 ~= 0);
ind = ~ismissing(b1);
ind1 = ~ismissing(b3)
% load('nameoffile.mat','b1','b2','b3','b4')
%
% save("nameoffile.mat","b1","b2","b3","b4",'-append')
figure(2);
subplot(1,2,1);
drawnow
hAxes = gca;
hold(hAxes,"on");
xlabel('CSI Amp');
ylabel('Keyhole Amp Low Res');
%plot(hAxes,b1(ind),b2(ind));
scatter(b1(ind),b2(ind),'filled')
[R,p] = corrcoef(b1,b2);
R = R(2);
p = p(2);
title(['R =' num2str(R) ', p =' num2str(p)]);
hold(hAxes,"off");
subplot(1,2,2);
drawnow
gAxes = gca;
hold(gAxes,"on");
xlabel('CSI R2M Amp');
ylabel('Keyhole R2M Amp Low Res');
%plot(gAxes,b3(ind1),b4(ind1),'o');
scatter(b3(ind1),b4(ind1),'filled')
[R,p] = corrcoef(b3,b4);
R = R(2);
p = p(2);
title(['R =' num2str(R) ', p =' num2str(p)]);
hold(gAxes,"off");
So I am trying to make two graphs on one tab. The one on the left will work fine, but the one on the right won't work. This only happens for certain sets of data when there is a NaN in the selected set. I used the "ind = ~ismissing(b1);" part to get b2 to ignore the coresponding point. But for some reason it does not want to graph b3 or b4 despite having the variables update correctly. It really just wont plot at all. Any and all advice is welcomed, thanks in advance!
댓글 수: 6
Torsten
2023년 6월 6일
Do b3 and b4 have the same size ? Do they contain Inf or -Inf elements ?
the cyclist
2023년 6월 6일
Can you upload a set of data for which the plots work as expected, and a set of data for which it does not?
William
2023년 6월 6일
William
2023년 6월 6일
the cyclist
2023년 6월 6일
FYI, to upload a MAT file with the data, you can use the paper clip icon in the INSERT section of the toolbar.
William
2023년 6월 6일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
