An interactive plot for classifying data!
显示 更早的评论
I am working with 3 matrices (Data1, Data2, Data3) where each row from each of the 3 matrices is a signal from the same time. I am attempting to have an interactive UI where the user can click if there's an abnormally or not. The code should record the answer from the toggle switch and plot the next 3 graphs until there's no more data.
I have two main issues:
- When pressing the toggle button, it will stay toggled until pressed again to untoggle before pressing the next anwer. It should untoggle--
- The recorded answer 'Result' gets erased on every iteration and I am not sure why!
Here is my code so far:
Results = table();
for ii = 1:10
pushbuttonPlot(Data1,Data2,Data3,ii)
waitforbuttonpress
end
function pushbuttonPlot(Data1,Data2,Data3,ii)
f = figure(1);
c = uicontrol('Position',[10 60 60 22]); %left, bottom, width, height
c.String = 'Abnormal';
c.Callback = @plotJointNext;
c2 = uicontrol('Position',[11+140 60 60 22]);
c2.String = 'Normal!!';
c2.Callback = @plotNoJointNext;
waitforbuttonpress
function plotJointNext(src,event)
figure(1)
subplot(3,1,1)
ylabel('Height (mm)')
plot(Data1((ii),:))
title(['Data 1, Index # ',num2str((ii))])
xlabel(' Points ')
subplot(3,1,2)
plot(Data2((ii),:))
ylabel('Height (mm)')
title(['Data 2, Index # ',num2str((ii))])
xlabel(' Points ')
subplot(3,1,3)
plot(Data3((ii),:))
ylabel('Height (mm)')
title(['Data 3, Index # ',num2str((ii))])
xlabel(' Points ')
Results(ii,:) = {('Abnormal')}
end
function plotNoJointNext(src,event)
figure(1)
subplot(3,1,1)
ylabel('Height (mm)')
plot(Data1((ii),:))
title(['Data 1, Index # ',num2str((ii))])
xlabel(' Points ')
subplot(3,1,2)
plot(Data2((ii),:))
ylabel('Height (mm)')
title(['Data 2, Index # ',num2str((ii))])
xlabel(' Points ')
subplot(3,1,3)
plot(Data3((ii),:))
ylabel('Height (mm)')
title(['Data 3, Index # ',num2str((ii))])
xlabel(' Points ')
Results(ii,:) = {('Normal')}
end
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!